Package org.glassfish.apf
Interface ProcessingContext
-
public interface ProcessingContext
This interface defines the context for the annotation processing handler. There is only one context instance per AnnotationProcessor invocation.- Author:
- Jerome Dochez
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ReadableArchive
getArchive()
Returns the module archive that can be used to load files/resources, that assist in the processing of annotations.ErrorHandler
getErrorHandler()
Return the error handler for this processing context.AnnotatedElementHandler
getHandler()
Return the current handler (if any) receving all the annotated elements start and stop events.<U extends AnnotatedElementHandler>
UgetHandler(Class<U> handlerType)
Return the top handler casted to the requested handler typeScanner
getProcessingInput()
Returns the Scanner implementation which is responsible for providing access to all the .class files the processing tool needs to scan.AnnotationProcessor
getProcessor()
Returns the AnnotationProcessor instance this context is associated with.AnnotatedElementHandler
popHandler()
Removes the top handlervoid
pushHandler(AnnotatedElementHandler handler)
Push a new handler on the stack of handlers.void
setArchive(ReadableArchive archive)
void
setErrorHandler(ErrorHandler errorHandler)
Sets the ErrorHandler instance for all errors/warnings that may be raised during the annotation processing.void
setProcessingInput(Scanner scanner)
Sets the Scanner implementation which is responsible for accessing all the .class files the AnnotationProcessor should process.
-
-
-
Method Detail
-
getProcessor
AnnotationProcessor getProcessor()
Returns the AnnotationProcessor instance this context is associated with.- Returns:
- annotation processor instance
-
getProcessingInput
Scanner getProcessingInput()
Returns the Scanner implementation which is responsible for providing access to all the .class files the processing tool needs to scan.- Returns:
- scanner instance
-
getArchive
ReadableArchive getArchive()
Returns the module archive that can be used to load files/resources, that assist in the processing of annotations. Using the ClassLoader is preferred, but not all files can be loaded by it and this can be handy in those cases.- Returns:
- module archive
-
setArchive
void setArchive(ReadableArchive archive)
-
setProcessingInput
void setProcessingInput(Scanner scanner)
Sets the Scanner implementation which is responsible for accessing all the .class files the AnnotationProcessor should process.
-
pushHandler
void pushHandler(AnnotatedElementHandler handler)
Push a new handler on the stack of handlers. This handler will receive all the AnnotedElementHandler events until it is removed from the stack with a popHandler() call.- Parameters:
handler
- the new events handler.
-
getHandler
AnnotatedElementHandler getHandler()
Return the current handler (if any) receving all the annotated elements start and stop events.- Returns:
- the top handler
-
popHandler
AnnotatedElementHandler popHandler()
Removes the top handler- Returns:
- the removed handler
-
getHandler
<U extends AnnotatedElementHandler> U getHandler(Class<U> handlerType) throws ClassCastException
Return the top handler casted to the requested handler type- Parameters:
requested
- handler type- Returns:
- the top handler
- Throws:
ClassCastException
- if the top handler cannot be casted to the requested handler type.
-
setErrorHandler
void setErrorHandler(ErrorHandler errorHandler)
Sets the ErrorHandler instance for all errors/warnings that may be raised during the annotation processing.- Parameters:
handler
- the annotation handler
-
getErrorHandler
ErrorHandler getErrorHandler()
Return the error handler for this processing context.- Returns:
- the error handler
-
-