Ben Madore
07/21/2020, 3:21 PMobject
hierarchy
e.g. i have:
object foo {
object bar {
val barval = "123"
val barval2 = "234"
}
object baz {
val bazval = "abc"
val bazval2 = "bcd
}
}
how can i programmatically get 123, 234, abc, bcd.
foo::class.nestedClasses.forEach{klazz ->
klazz.memberProperties.forEach{ it: KProperty1<out Any,*>
println(it)
}
}
gets me all the properties e.g.
val foo.bar.barval: kotlin.String
val foo.bar.barval2: kotlin.String
val foo.baz.bazval2: kotlin.String
val foo.baz.bazval2: kotlin.String
but i’m unclear on how to actually get those values