vendredi 1 décembre 2017

How to check AnnotationInvocationHandler relationship with Annotation

I have an annotation defined as

@interface A {}

A class using this annotation

class C {
  @A String f;
}

However, at runtime it is wrapped by a Proxy with AnnotationInvocationHandler, e.g. Field f = C.class.getField("f"); f.getDeclaredAnnotations() returns an array of this Proxy. How can I check wether field f of class C is annotated with annotation A in this situation?

Note: f.isAnnotationPresent(A.class) returns false





Aucun commentaire:

Enregistrer un commentaire