Class AnnotationProcessor

  • All Implemented Interfaces:
    Processor

    @SupportedAnnotationTypes("*")
    public class AnnotationProcessor
    extends AbstractProcessor
    An annotation processor for indexing Indexable annotations 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 Plugin annotation enables the Context application 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