Package org.scijava.annotations
Class AnnotationProcessor
- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- org.scijava.annotations.AnnotationProcessor
-
- All Implemented Interfaces:
Processor
@SupportedAnnotationTypes("*") public class AnnotationProcessor extends AbstractProcessor
An annotation processor for indexingIndexableannotations at compile time. The design is inspired by Sezpoz, a compile-time indexing library by Jesse Glick.For each annotated class, this processor writes a JSON record of the annotation's attributes into
META-INF/json/under a file named after the annotation type. At runtime, the index can be read to discover annotated classes and inspect their annotation values without loading (and therefore initializing) those classes — avoiding the cost and side-effects of a full classpath scan.For example, SciJava Common's
Pluginannotation enables theContextapplication container to discover and prepare the application including all its plugins without needing to load all of those plugins in advance. Rather, they can be loaded upon first use in each appropriate context, greatly reducing application startup cost.- Author:
- Johannes Schindelin
-
-
Field Summary
-
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
-
-
Constructor Summary
Constructors Constructor Description AnnotationProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SourceVersiongetSupportedSourceVersion()booleanprocess(Set<? extends TypeElement> elements, RoundEnvironment env)-
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, init, isInitialized
-
-
-
-
Method Detail
-
getSupportedSourceVersion
public SourceVersion getSupportedSourceVersion()
- Specified by:
getSupportedSourceVersionin interfaceProcessor- Overrides:
getSupportedSourceVersionin classAbstractProcessor
-
process
public boolean process(Set<? extends TypeElement> elements, RoundEnvironment env)
- Specified by:
processin interfaceProcessor- Specified by:
processin classAbstractProcessor
-
-