lundi 11 janvier 2021

Invoke nested deepobject method via reflection

Is it possible to invoke nested method inside nested object from real object using reflection? Something like this

val fieldDefinition = chatClient.javaClass.getDeclaredField("class1")
  .type.getDeclaredField("class2").type.getDeclaredField("class3")

Real object i have is chatClient and i want to invoke method of class3, which i cannot obtain directly but via class1 path.





Aucun commentaire:

Enregistrer un commentaire