org.glassfish.apf.impl
Class AnnotationProcessorImpl

java.lang.Object
  extended by org.glassfish.apf.impl.AnnotationProcessorImpl
All Implemented Interfaces:
AnnotationProcessor

public class AnnotationProcessorImpl
extends java.lang.Object
implements AnnotationProcessor

Author:
dochez

Constructor Summary
AnnotationProcessorImpl()
          Creates a new instance of AnnotationProcessorImpl
 
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)
           
 java.util.Stack<org.glassfish.apf.impl.StackElement> getStack()
           
 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.
 void setDelegate(AnnotationProcessorImpl delegate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationProcessorImpl

public AnnotationProcessorImpl()
Creates a new instance of AnnotationProcessorImpl

Method Detail

setDelegate

public void setDelegate(AnnotationProcessorImpl delegate)

createContext

public ProcessingContext createContext()
Description copied from interface: AnnotationProcessor
Creates a new empty ProcessingContext instance which can be configured before invoking the process() method.

Specified by:
createContext in interface AnnotationProcessor
Returns:
an empty ProcessingContext

log

public void log(java.util.logging.Level level,
                AnnotationInfo locator,
                java.lang.String localizedMessage)
Log a message on the default logger

Specified by:
log in interface AnnotationProcessor

process

public ProcessingResult process(ProcessingContext ctx)
                         throws AnnotationProcessorException
Starts the annotation processing tool passing the processing context which encapuslate all information necessary for the configuration of the tool.

Specified by:
process in interface AnnotationProcessor
Parameters:
ctx - is the initialized processing context
Returns:
the result of the annoations processing
Throws:
AnnotationProcessorException

process

public ProcessingResult process(ProcessingContext ctx,
                                java.lang.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:
process in interface AnnotationProcessor
Parameters:
the - processing context
the - list of classes to process
Returns:
the processing result for such classes
Throws:
AnnotationProcessorException - if handlers fail to process an annotation

pushAnnotationHandler

public void pushAnnotationHandler(AnnotationHandler handler)
Description copied from interface: AnnotationProcessor
Registers 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:
pushAnnotationHandler in interface AnnotationProcessor
Parameters:
handler - the annotation handler instance

popAnnotationHandler

public void popAnnotationHandler(java.lang.Class<? extends java.lang.annotation.Annotation> type)
Description copied from interface: AnnotationProcessor
Unregisters the last annotation handler registered for an annotation type.

Specified by:
popAnnotationHandler in interface AnnotationProcessor
Parameters:
type - the annotation type.

getAnnotationHandler

public AnnotationHandler getAnnotationHandler(java.lang.Class<? extends java.lang.annotation.Annotation> type)
Specified by:
getAnnotationHandler in interface AnnotationProcessor
Parameters:
type - the annotation type
Returns:
the top annotation handler for a particular annotation type

getLastAnnotatedElement

public java.lang.reflect.AnnotatedElement getLastAnnotatedElement(java.lang.annotation.ElementType type)
Specified by:
getLastAnnotatedElement in interface AnnotationProcessor
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

public java.util.Stack<org.glassfish.apf.impl.StackElement> getStack()


Copyright © 2012 GlassFish Community. All Rights Reserved.