I want to get a list of inner objects of a scala object. Sample code:
object Outer {
val v = "-"
def d = "-"
object O1
object O2
}
object Main {
def main(args: Array[String]) {
Outer.getClass.getDeclaredMethods.map(_.getName) foreach println // prints d and v
// Outer.getClass.get ... Objects???
}
}
I can find v and d, but how can I find O1 and O2 ?
With the new reflection library in Scala 2.10 (since Milestone 4) it is possible to get the inner objects: