Package org.glassfish.apf.impl
Class AnnotationProcessorImpl
java.lang.Object
org.glassfish.apf.impl.AnnotationProcessorImpl
- All Implemented Interfaces:
AnnotationProcessor
- Author:
- dochez
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new empty ProcessingContext instance which can be configured before invoking the process() method.getAnnotationHandler(Class<? extends Annotation> type) Stack<org.glassfish.apf.impl.StackElement> getStack()voidlog(Level level, AnnotationInfo locator, String localizedMessage) Log a message on the default LOGvoidpopAnnotationHandler(Class<? extends Annotation> type) Unregisters the last annotation handler registered for an annotation type.process(ProcessingContext ctx) Starts the annotation processing tool passing the processing context which encapuslate all information necessary for the configuration of the tool.process(ProcessingContext ctx, Class<?>[] classes) Process a set of classes from the parameter list rather than from the processing context.voidpushAnnotationHandler(String type, AnnotationHandler handler) This method is similar topushAnnotationHandler(AnnotationHandler)except that it takes an additional String type argument which allows us to avoid extracting the information from the AnnotationHandler.voidpushAnnotationHandler(AnnotationHandler handler) Registers a new AnnotationHandler for a particular annotation type.voidsetDelegate(AnnotationProcessorImpl delegate)
-
Constructor Details
-
AnnotationProcessorImpl
public AnnotationProcessorImpl()
-
-
Method Details
-
setDelegate
-
createContext
Description copied from interface:AnnotationProcessorCreates a new empty ProcessingContext instance which can be configured before invoking the process() method.- Specified by:
createContextin interfaceAnnotationProcessor- Returns:
- an empty ProcessingContext
-
log
Log a message on the default LOG- Specified by:
login interfaceAnnotationProcessor
-
process
Starts the annotation processing tool passing the processing context which encapuslate all information necessary for the configuration of the tool.- Specified by:
processin interfaceAnnotationProcessor- Parameters:
ctx- is the initialized processing context- Returns:
- the result of the annoations processing
- Throws:
AnnotationProcessorException
-
process
public ProcessingResult process(ProcessingContext ctx, Class<?>[] classes) throws AnnotationProcessorException Process a set of classes from the parameter list rather than from the processing context. This allow the annotation handlers to call be the annotation processing tool when classes need to be processed in a particular context rather than when they are picked up by the scanner.- Specified by:
processin interfaceAnnotationProcessor- Parameters:
ctx- the processing contextclasses- the list of classes to process- Returns:
- the processing result for such classes
- Throws:
AnnotationProcessorException- if handlers fail to process an annotation
-
pushAnnotationHandler
Description copied from interface:AnnotationProcessorRegisters a new AnnotationHandler for a particular annotation type. New annotation handler are pushed on a List of annotation handlers for that particular annotation type, the last annotation handler to be registered will be invoked first and so on. The annotation type handled by the AnnotationHandler instance is defined by the getAnnotationType() method of the AnnotationHandler instance- Specified by:
pushAnnotationHandlerin interfaceAnnotationProcessor- Parameters:
handler- the annotation handler instance
-
pushAnnotationHandler
This method is similar topushAnnotationHandler(AnnotationHandler)except that it takes an additional String type argument which allows us to avoid extracting the information from the AnnotationHandler. Calling the AnnotationHandler can lead to its instantiation where as the annotation that a handler is responsible for handling is a metadata that can be statically extracted. This allows us to build more lazy systems.- Parameters:
type-handler-
-
popAnnotationHandler
Description copied from interface:AnnotationProcessorUnregisters the last annotation handler registered for an annotation type.- Specified by:
popAnnotationHandlerin interfaceAnnotationProcessor- Parameters:
type- the annotation type.
-
getAnnotationHandler
- Specified by:
getAnnotationHandlerin interfaceAnnotationProcessor- Parameters:
type- the annotation type- Returns:
- the top annotation handler for a particular annotation type
-
getLastAnnotatedElement
- Specified by:
getLastAnnotatedElementin interfaceAnnotationProcessor- Parameters:
type- the annotated element- Returns:
- the last element pushed on the stack which ElementType was the one passed or null if no stack element is of the given type.
-
getStack
-