jeudi 3 décembre 2015

How to determine target of Annotation using reflection?

Assume I have a runtime annotation @foo with @Target({ElementType.PARAMETER}).

Also assume that I use it to annotate a method:

void someFunction(@foo Bar bar) {
  // ...
}

I have an instance Annotation annotation that corresponds to the annotation in someFunction above.

Is there anyway to use my instance annotation (and reflection) to determine the type of the parameter bar is of type Bar?





Aucun commentaire:

Enregistrer un commentaire