Reputation: 9521
I have multiple objects containing case class
declarations. For example:
object model1{
//case classes
}
object model2{
//case classes
}
object model3{
//case classses
}
Importing each of those model
s separately is cumbersome. Is it possible to import it at once somehow?
The following does not work
object all{
import model1._
import model2._
import model3._
}
import all._
Maybe some macro can be useful here?
Upvotes: 0
Views: 86
Reputation: 27535
Theoretically you could take a look at all definitions in each of these objects, and generate code, that basically delegates implicit
, val
, def
, type
to definition in original object, but that would be:
If you are on Scala 2.13 you can try using something like -Yimports
to configure global imports, if you use imports very often - it should be supported by newest IntelliJ.
On Scala 3 you will have export as mentioned by @Luis Miguel Mejía Suárez.
Upvotes: 2