Class AnalyzeProcessor

All Implemented Interfaces:
Processor

@SupportedAnnotationTypes("*") @SupportedOptions("verbosity") public class AnalyzeProcessor extends AbstractTentackleProcessor
Annotation processor for all annotations annotated with Analyze.

The processor claims all annotations and follows their meta-annotations recursively until it finds @Analyze. The handler named by @Analyze is loaded via the processing classloader, instantiated, and invoked for the annotation. The handlers write service descriptors to the service directory and analyze info files to the analyze directory.

Author:
harald
  • Field Details

    • COMPILE_ERROR_LOG

      public static final String COMPILE_ERROR_LOG
      Logfile for compilation errors during the analyze-phase.
      The logfile is missing if no errors were detected. Otherwise, analyze info files may be incomplete or missing.
      See Also:
  • Constructor Details

    • AnalyzeProcessor

      public AnalyzeProcessor()
  • Method Details

    • getProcessingClassLoader

      public ClassLoader getProcessingClassLoader()
      Gets the classloader to be used instead of the default.
      Used to load the handlers and, if necessary, the annotation classes. The Tentackle Maven plugin sets a classloader that also searches the project's classpath.
      Returns:
      the classloader, never null (fallback to the classloader of this processor)
    • setProcessingClassLoader

      public void setProcessingClassLoader(ClassLoader processingClassLoader)
      Sets the classloader to be used instead of the default.
      Parameters:
      processingClassLoader - the classloader, null if default
    • getAnalyzeDir

      public File getAnalyzeDir()
      Gets the generated analyze files directory.
      Returns:
      the output dir
    • setAnalyzeDir

      public void setAnalyzeDir(File outputDir)
      Sets the generated analyze files directory.
      Parameters:
      outputDir - the output dir
    • getServiceDir

      public File getServiceDir()
      Gets the generated services resource directory.
      Returns:
      the resources file dir
    • setServiceDir

      public void setServiceDir(File serviceDir)
      Sets the generated services resource directory.
      Parameters:
      serviceDir - the resource dir
    • process

      public boolean process(Set<? extends TypeElement> annotationTypes, RoundEnvironment roundEnv)

      Processes all annotations that are annotated with @Analyze, either directly or via meta-annotations. The recursive scan allows annotating only once for a group of annotations. An annotation is claimed if at least one handler was found.

      Specified by:
      process in interface Processor
      Specified by:
      process in class AbstractProcessor