Package org.glassfish.apf

Provides the classes necessary to process J2SE 1.5 annotations in the context of the J2EE application server.

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