Class AnnotationProcessorImpl

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

public class AnnotationProcessorImpl extends Object implements AnnotationProcessor
Author:
dochez
  • Constructor Details

    • AnnotationProcessorImpl

      public AnnotationProcessorImpl()
  • Method Details

    • 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(Level level, AnnotationInfo locator, String localizedMessage)
      Log a message on the default LOG
      Specified by:
      log in interface AnnotationProcessor
    • process

      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, 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:
      ctx - the processing context
      classes - 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
    • pushAnnotationHandler

      public void pushAnnotationHandler(String type, AnnotationHandler handler)
      This method is similar to pushAnnotationHandler(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

      public void popAnnotationHandler(Class<? extends 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(Class<? extends 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 AnnotatedElement getLastAnnotatedElement(ElementType type)
      Specified by:
      getLastAnnotatedElement in interface AnnotationProcessor
      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

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