I am trying to clean up my user api, so that users can neatly just import from a single package object, and get all the stuff inside. I realize I can just move my packages to sit in the top package, but I was wondering if there is a way to do the following (i get it may not be best practice):
I have the following packages:
package org.Me.packages.packageA
case class A() {
// some implementation
}
package org.Me.packages.packageB
case class B() {
// some implementation
}
Now this would require imports of the form:
import org.Me.packages.packageA.A
import org.Me.packages.packageB.B
What I was requested to do was the following:
package org.Me.combinedPackages
package object Combined {
import org.Me.packages.packageA.A
import org.Me.packages.packageB.B
}
So that my end user can simply do:
import org.Me.combinedPackages._
// access both a and b here
from what I read here, I understand it to mean nested imports are not possible.
So is what I am trying to do impossible? I realize other ways exist.