@Override
  public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Processing @Implemented...");
    for (TypeElement annotation : annotations) {
      for (Element element : roundEnv.getElementsAnnotatedWith(annotation)) {
        TypeElement serviceElement = (TypeElement) element;
        PackageElement packageElement = getPackage(serviceElement);
        final String packageName =
            packageElement == null ? "" : packageElement.getQualifiedName().toString();
        Implemented implemented = serviceElement.getAnnotation(Implemented.class);
        final String implName =
            "".equals(implemented.value())
                ? serviceElement.getSimpleName().toString() + "Impl"
                : implemented.value();
        final List<FieldDescriptor> fields = createFieldList(serviceElement);
        final String localName = determineLocalName(serviceElement);
        final boolean isPublic = serviceElement.getModifiers().contains(Modifier.PUBLIC);
        ImplementedDescriptor annotationDescriptor =
            new ImplementedDescriptor(isPublic, packageName, implName, localName, fields);
        createImplSourceFile(annotationDescriptor, serviceElement, packageName + "." + implName);
      }
    }

    return true;
  }
 @Override
 public final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
   for (TypeElement elem : ElementFilter.typesIn(roundEnv.getRootElements())) {
     elements.add(elem.getQualifiedName());
   }
   return false;
 }
 @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;
 }
 private List<FieldDescriptor> createFieldList(TypeElement serviceElement) {
   return ListUtils.unmodifiableList(
       CollectionUtils.collect(
           serviceElement.getEnclosedElements(),
           new Transformer<Element, FieldDescriptor>() {
             @Override
             public FieldDescriptor transform(Element enclosed) {
               FieldDescriptor fieldDescriptor =
                   enclosed.accept(AnnotationFieldVisitor.INSTANCE, utils);
               return fieldDescriptor;
             }
           },
           new ArrayList<FieldDescriptor>()));
 }
 private void checkSupertype(TypeElement te, String expect) {
   System.err.println("check supertype: " + te + " -- " + expect);
   String found = asString(te.getSuperclass());
   checkEqual("supertype", te, found, expect);
 }
 private void checkInterfaces(TypeElement te, String expect) {
   System.err.println("check interfaces: " + te + " -- " + expect);
   String found = asString(te.getInterfaces(), ", ");
   checkEqual("interfaces", te, found, expect);
 }
 private String determineLocalName(final TypeElement serviceElement) {
   return serviceElement.getQualifiedName().toString();
 }