I need to use some way to get all fields that are annotated with a specific annotation. The annotation may be at the field or the getter (of a super class), like
public MyClass {
@MyAnnotation
String myName;
int myAge;
@MyAnnotation
int getMyAge() { return myAge; }
}
So I need Field[] getAllAnnotatedFields(MyClass.class, MyAnnotation.class)
.
I could write that method on my own, but I wonder, if there exists some util method. (I cannot found one in Apache commons, Guava or Google reflections).
Aucun commentaire:
Enregistrer un commentaire