Example #1
0
 @Override
 public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
   for (TypeElement te : ElementFilter.typesIn(roundEnv.getRootElements())) {
     if (isSimpleName(te, "InvalidSource")) {
       for (Element c : te.getEnclosedElements()) {
         for (AnnotationMirror am : c.getAnnotationMirrors()) {
           Element ate = am.getAnnotationType().asElement();
           if (isSimpleName(ate, "ExpectInterfaces")) {
             checkInterfaces((TypeElement) c, getValue(am));
           } else if (isSimpleName(ate, "ExpectSupertype")) {
             checkSupertype((TypeElement) c, getValue(am));
           }
         }
       }
     }
   }
   return true;
 }
Example #2
0
 private String getValue(AnnotationMirror am) {
   Map<? extends ExecutableElement, ? extends AnnotationValue> map = am.getElementValues();
   if (map.size() != 1) throw new IllegalArgumentException();
   AnnotationValue v = map.values().iterator().next();
   return (String) v.getValue();
 }