vendredi 27 juillet 2018

Reflection Java - Get all fields of all declared class

based on this question Get all Fields of class hierarchy

I have a similar question:

i have class A and B:

class A {
  @SomeAnnotation
  long field1;

  B field2; //how can i access field of this class?

}


class B {

  @SomeAnnotation
  long field3;

}

I want to get all fields values that have the annotation @SomeAnnotation from this 2 class.

like:

A.field1

B.field3





Aucun commentaire:

Enregistrer un commentaire