The annotation processor is the core engine to process annotations. All the processing configuration (input classes, error handlers, etc...) is provided by the ProcessingContext which can be either created from the createContext method or through another mean. Once the ProcessingContext has been initialized, it is passed to the process(ProcessingContext ctx) method which triggers the annotation processing.
Each class accessible from the ProcessingContext.getInputScanner instance, will be scanned for annotations. Each annotation will then be processed by invoking the corresponding AnnotationHandler from its annotation type.
The AnnotationProcessor can be configured by using the pushAnnotationHandler and popAnnotationHandler which allow new AnnotationHandler instances to be registered and unregistered for a particular annotation type.
Even without reconfiguring the AnnotationProcessor instance with the above configuration methods, the AnnotationProcessor implementation cannot guarantee to be thread safe, therefore, it is encouraged the make instanciation cheap and users should not use the same instance concurrently.
@author Jerome DochezAn annotation processor is constructed by a {@linkplain AnnotationProcessorFactory factory}, which provides it with an {@linkplain AnnotationProcessorEnvironment environment} thatencapsulates the state it needs. Messages regarding warnings and errors encountered during processing should be directed to the environment's {@link Messager}, and new files may be created using the environment's {@link Filer}.
Each annotation processor is created to process annotations of a particular annotation type or set of annotation types. It may use its environment to find the program elements with annotations of those types. It may freely examine any other program elements in the course of its processing. @author Joseph D. Darcy @author Scott Seligman @version 1.3 05/11/17 @since 1.5
Base class for modifying the internal domain model, starting at {@link Contract}, and adding parts to it.
@see org.gcontracts.annotations.meta.AnnotationProcessorImplementation @author ast
|
|
|
|
|
|