0

I have two annotations, we'll call them @Foo and @Bar. @Foo is a class (aka type)-level annotation and @Bar is a method-level annotation. My intent is for a given @Foo class, iterate over all the @Bar methods. What is the most appropriate way to do this? I'm using the Google Reflections API for Java, at the moment.

Thanks.

Peter
  • 1,032
  • 1
  • 11
  • 26
  • 1
    you can simply use `fooClass.getDeclaredMethods()` to enumerate the (declared) methods and `method.getAnnotation(Bar.class) != null` to filter for the bar methods, – wero Jan 18 '16 at 18:02

1 Answers1

0

Wero's comment worked: "you can simply use fooClass.getDeclaredMethods() to enumerate the (declared) methods and method.getAnnotation(Bar.class) != null to filter for the bar methods"

Peter
  • 1,032
  • 1
  • 11
  • 26