Search for all instances of certain annotation type
- by user1064918
Suppose I have this annotation
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Name
{
String value();
}
This is going to be used as follows
@Name("name1")
public static Foo foo = new Foo();
I have multiples of these across my project source files. Is there an fairly simple way to search and collect all those "foo"s that're preceded by @Name?
In other words, I'd like to write a method that would return a Set<Foo> containing these.
Thanks!!!