Reputation: 1179
Well I have a scala class Foo.scala
containing these two elements,
First One,
case class Foo(
.
.
.
)
And secondly,
object Foo{
.
.
.
}
Now when I import the Foo in some other file, I want to use the case class not the Object, but when I import the file, object instance is returned in Foo<= this is the object,(I needed to do Foo.apply, Foo.tupled)
Is there anyway I can get the Foo to act as the case class then an object.
Upvotes: 0
Views: 2729
Reputation: 1689
You have ambiguity in your scala namespaces. A simple solution to the problem would be to nest the case class inside of the object, then import it with
import Foo.Foo
another solution would be to place them in separate packages. Depending on your system design this could affect the cohesiveness of your packages, which in my mind is probably more important.
Upvotes: 0