예제 #1
0
 /**
  * If the processor class is annotated with {@link SupportedAnnotationTypes}, return an
  * unmodifiable set with the same set of strings as the annotation. If the class is not so
  * annotated, an empty set is returned.
  *
  * @return the names of the annotation types supported by this processor, or an empty set if none
  */
 public Set<String> getSupportedAnnotationTypes() {
   SupportedAnnotationTypes sat = this.getClass().getAnnotation(SupportedAnnotationTypes.class);
   if (sat == null) {
     if (isInitialized())
       processingEnv
           .getMessager()
           .printMessage(
               Diagnostic.Kind.WARNING,
               "No SupportedAnnotationTypes annotation "
                   + "found on "
                   + this.getClass().getName()
                   + ", returning an empty set.");
     return Collections.emptySet();
   } else return arrayToSet(sat.value());
 }
예제 #2
0
 /**
  * If the processor class is annotated with {@link SupportedSourceVersion}, return the source
  * version in the annotation. If the class is not so annotated, {@link SourceVersion#RELEASE_6} is
  * returned.
  *
  * @return the latest source version supported by this processor
  */
 public SourceVersion getSupportedSourceVersion() {
   SupportedSourceVersion ssv = this.getClass().getAnnotation(SupportedSourceVersion.class);
   SourceVersion sv = null;
   if (ssv == null) {
     sv = SourceVersion.RELEASE_6;
     if (isInitialized())
       processingEnv
           .getMessager()
           .printMessage(
               Diagnostic.Kind.WARNING,
               "No SupportedSourceVersion annotation "
                   + "found on "
                   + this.getClass().getName()
                   + ", returning "
                   + sv
                   + ".");
   } else sv = ssv.value();
   return sv;
 }
예제 #3
0
 @Override
 public synchronized void init(ProcessingEnvironment processingEnv) {
   super.init(processingEnv);
   this.utils = new Utils(processingEnv.getElementUtils(), processingEnv.getTypeUtils());
 }