|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface AnnotationProcessor
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.
| Method Summary | |
|---|---|
ProcessingContext |
createContext()
Creates a new empty ProcessingContext instance which can be configured before invoking the process() method. |
AnnotationHandler |
getAnnotationHandler(java.lang.Class<? extends java.lang.annotation.Annotation> type)
|
java.lang.reflect.AnnotatedElement |
getLastAnnotatedElement(java.lang.annotation.ElementType type)
|
void |
log(java.util.logging.Level level,
AnnotationInfo locator,
java.lang.String localizedMessage)
Log a message on the default logger |
void |
popAnnotationHandler(java.lang.Class<? extends java.lang.annotation.Annotation> type)
Unregisters the last annotation handler registered for an annotation type. |
ProcessingResult |
process(ProcessingContext ctx)
Starts the annotation processing tool passing the processing context which encapuslate all information necessary for the configuration of the tool. |
ProcessingResult |
process(ProcessingContext ctx,
java.lang.Class[] classes)
Process a set of classes from the parameter list rather than from the processing context. |
void |
pushAnnotationHandler(AnnotationHandler handler)
Registers a new AnnotationHandler for a particular annotation type. |
| Method Detail |
|---|
ProcessingContext createContext()
ProcessingResult process(ProcessingContext ctx)
throws AnnotationProcessorException
ctx - is the initialized processing context
AnnotationProcessorException
ProcessingResult process(ProcessingContext ctx,
java.lang.Class[] classes)
throws AnnotationProcessorException
the - processing contextthe - list of classes to process
AnnotationProcessorException - if handlers fail to process
an annotationvoid pushAnnotationHandler(AnnotationHandler handler)
type - the annotation typehandler - the annotation handler instanceAnnotationHandler getAnnotationHandler(java.lang.Class<? extends java.lang.annotation.Annotation> type)
type - the annotation type
void popAnnotationHandler(java.lang.Class<? extends java.lang.annotation.Annotation> type)
type - the annotation type.java.lang.reflect.AnnotatedElement getLastAnnotatedElement(java.lang.annotation.ElementType type)
void log(java.util.logging.Level level,
AnnotationInfo locator,
java.lang.String localizedMessage)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||