Package org.glassfish.apf
Annotations are defined by their annotation type. This tool assumes that annotation handlers will be registered to it to process a particular annotation type. These annotation handlers have no particular knowledge outside of the annotation they process and the annotated element on which the annotation was defined.
The AnnotationProcessor tool implementation is responsible for maintaining a list of annotations handlers per annotation type. AnnotationHandler are added to the tool through the pushAnnotationHandler and can be removed through the popAnnotationHandler. Alternatively, the Factory singleton can be used to get an initialised AnnotationProcessor with all the default AnnotationHandler.
The tool uses the ProcessingContext to have access to Class instances. Each class instance will be processed in order, and if annotations are present, the tool will also process Field, Constructor and Methods elements. Each time the annotation processor switches for one particular AnnotatedElement to another, it will send start and stop events to any AnnotatedElementHandler interface implementation registered within the ProcessingContext. This allow client code to keep context information about the AnnotatedElements being processed since AnnotationHandler only know about the AnnotatedElement the annotation was defined on.
- Since:
- 9.0
-
Interface Summary Interface Description AnnotatedElementHandler Provides notification when the annotation processor is visiting a new AnnotatedElement.AnnotationHandler This interface defines the contract for annotation handlers and the annotation processing engine.AnnotationProcessor The annotation processor is the core engine to process annotations.ComponentInfo This class encapsulates information about a component (usually a Java EE component).ErrorHandler Basic interfaced for annotation processing warnings and errorsHandlerProcessingResult This interface defines the result of an annotation processing returned by an annotation handler.ProcessingContext This interface defines the context for the annotation processing handler.ProcessingResult This interface encapsulates all AnnotatedElements processing result by the AnnotationProcessor tool.Scanner<T> This interface is responsible for scanning the binary location provided and provide each binary file through a pull interfaces -
Class Summary Class Description AnnotationInfo Instances encapsulate all information necessary for an AnnotationHandler to process an annotation. -
Enum Summary Enum Description ResultType Defines the result from a single annotation processing, UNPROCESSED mean the annotation has not been processed by any handler yet, PROCESSED mean that all processing had been done and the annotation was fully processed, FAILED indicate an error condition. -
Exception Summary Exception Description AnnotationProcessorException Exception that denotes a warning or error condition in the annotation processing tool -
Annotation Types Summary Annotation Type Description AnnotationHandlerFor Normally goes withService
annotation, and this annotation must be placed on a class that implementsAnnotationHandler
.