vendredi 18 août 2017

How to access the object-members of an object declaration in kotlin

Say you have the following, nested object declaration:

object Father {   
    val fathersField = "value"
    object Child {
        val childsField = 3.141592654
    }
}

When I use reflection starting from Father, I'm able to find the field fathersField only but no member referencing the Child instance.

Is it possible to find those inner object declarations via reflection? And if so, how?





Aucun commentaire:

Enregistrer un commentaire