mercredi 7 septembre 2016

How to access the contained classes fields using reflection?

I want to access all the fields with @customannotation in the class hierarchy .

The class structure is as follows:

Class A{
private Arraylist<B> b;
.
.
}
Class B{
@customannotation
private C c;
.
.
}
Class C{
@customannotation
private String c;
.
.
}

I tried class.getDeclaredClasses() but its returning 0 classes. Please help me out in recursive parsing to find all fields with @customannotation in the class hierarchy .





Aucun commentaire:

Enregistrer un commentaire