Skip to content

Instantly share code, notes, and snippets.

@igor-brishkoski
Last active February 5, 2017 02:08
Show Gist options
  • Save igor-brishkoski/0d05159e7e12464a27dafb62f1d355d7 to your computer and use it in GitHub Desktop.
Save igor-brishkoski/0d05159e7e12464a27dafb62f1d355d7 to your computer and use it in GitHub Desktop.
Filter Elements Guava
@Override
public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
//get all elements annotated with AwesomeLogger
Collection<? extends Element> annotatedElements = roundEnvironment.getElementsAnnotatedWith(AwesomeLogger.class);
//filter out elements we don't need
List<TypeElement> types = new ImmutableList.Builder<TypeElement>()
.addAll(ElementFilter.typesIn(annotatedElements))
.build();
for (TypeElement type : types) {
...
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment