Example #1
0
  public AnnotationProcessor getProcessorFor(
      Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) {

    if (bcproc == null) bcproc = new BuildCompleteProcessor(env);

    ArrayList<AnnotationProcessor> aps = new ArrayList<AnnotationProcessor>();
    for (AnnotationTypeDeclaration atdecl : atds) {

      if (atdecl.getQualifiedName().equals(Exportable.class.getName())) {
        // System.out.println("Getting Exportable processor");
        aps.add(new ExportableProcessor(env, bcproc));
      }
      if (atdecl.getQualifiedName().equals(Service.class.getName())) {
        aps.add(new ServiceProcessor(env, bcproc));
      }
      if (atdecl.getQualifiedName().equals(LocalService.class.getName())) {
        aps.add(new LocalServiceProcessor(env, bcproc));
      }
      if (atdecl.getQualifiedName().equals(ServiceUI.class.getName())) {
        aps.add(new ServiceUIProcessor(env, bcproc));
      }
      if (atdecl.getQualifiedName().equals(LeasedResource.class.getName())) {
        aps.add(new LeasedResourceProcessor(env, bcproc));
      }
      if (atdecl.getQualifiedName().equals(Client.class.getName())) {
        aps.add(new ClientProcessor(env, bcproc));
      }
    }
    // We return a combined processor for all the annotations in the file
    if (aps.size() > 0) return AnnotationProcessors.getCompositeAnnotationProcessor(aps);
    else {
      env.getMessager().printNotice("Checking for any more final processing");
      if (bcproc.awaitingPostProcessing()) return bcproc;
      else {
        env.getMessager().printNotice("Current Glyph processing complete.....");
        return AnnotationProcessors.NO_OP;
      }
    }
  }