mardi 17 novembre 2015

Get field annotations of class from child field

Is there any method to get value of @AnnotationB of bClass from fieldC?

Class A {
    @AnnotationB("a")
    B bClass;
}

Class B{
     String fieldC;
}

Currently I can get only declaring annotations of bClass as Class:

...
fieldC.getDeclaringClass().getAnnotation(AnnotationB.class)
...

In this case annotation will be not found.





Aucun commentaire:

Enregistrer un commentaire