org.eclipse.jdt.internal.compiler.apt.dispatch
类 BaseAnnotationProcessorManager

java.lang.Object
  继承者 org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager
      继承者 org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager
所有已实现的接口:
IProcessorProvider
直接已知子类:
BatchAnnotationProcessorManager

public abstract class BaseAnnotationProcessorManager
extends AbstractAnnotationProcessorManager
implements IProcessorProvider

This class is the central dispatch point for Java 6 annotation processing. This is created and configured by the JDT core; specifics depend on how compilation is being performed, ie from the command line, via the Tool interface, or within the IDE. This class manages the discovery of annotation processors and other information spanning multiple rounds of processing; context that is valid only within a single round is managed by RoundDispatcher. There may be multiple instances of this class; there is in general one of these for every Compiler that has annotation processing enabled. Within the IDE there will typically be one for every Java project, because each project potentially has a separate processor path. TODO: do something useful with _supportedOptions and _supportedAnnotationTypes.


字段摘要
protected  PrintWriter _err
           
protected  boolean _isFirstRound
           
protected  PrintWriter _out
           
protected  boolean _printProcessorInfo
           
protected  boolean _printRounds
           
protected  BaseProcessingEnvImpl _processingEnv
           
protected  List<ProcessorInfo> _processors
          The list of processors that have been loaded so far.
protected  int _round
           
 
构造方法摘要
BaseAnnotationProcessorManager()
           
 
方法摘要
 void configure(Object batchCompiler, String[] options)
          Configure the receiver using the given batch compiler and the given options.
 void configureFromPlatform(Compiler compiler, Object compilationUnitLocator, Object javaProject)
          Configure the receiver using the given compiler, the given compilationUnitLocator and the given java project.
 ICompilationUnit[] getDeletedUnits()
          Returns the deleted units.
 List<ProcessorInfo> getDiscoveredProcessors()
           
 ReferenceBinding[] getNewClassFiles()
          Return the new binary bindings created in the last round.
 ICompilationUnit[] getNewUnits()
          Return the new units created in the last round.
 void processAnnotations(CompilationUnitDeclaration[] units, ReferenceBinding[] referenceBindings, boolean isLastRound)
          A single "round" of processing, in the sense implied in javax.lang.annotation.processing.Processor.
 void reset()
          Reinitialize the receiver
 void setErr(PrintWriter err)
          Set the print writer for the standard error.
 void setOut(PrintWriter out)
          Set the print writer for the standard output.
 void setProcessors(Object[] processors)
          Set the processors for annotation processing.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 org.eclipse.jdt.internal.compiler.apt.dispatch.IProcessorProvider 继承的方法
discoverNextProcessor, reportProcessorException
 

字段详细信息

_out

protected PrintWriter _out

_err

protected PrintWriter _err

_processingEnv

protected BaseProcessingEnvImpl _processingEnv

_isFirstRound

protected boolean _isFirstRound

_processors

protected List<ProcessorInfo> _processors
The list of processors that have been loaded so far. A processor on this list has been initialized, but may not yet have been called to process().


_printProcessorInfo

protected boolean _printProcessorInfo

_printRounds

protected boolean _printRounds

_round

protected int _round
构造方法详细信息

BaseAnnotationProcessorManager

public BaseAnnotationProcessorManager()
方法详细信息

configure

public void configure(Object batchCompiler,
                      String[] options)
从类 AbstractAnnotationProcessorManager 复制的描述
Configure the receiver using the given batch compiler and the given options. The parameter batchCompiler is expected to be an instance of the batch compiler. This method is only used for the batch mode. For the IDE mode, please see AbstractAnnotationProcessorManager.configureFromPlatform(Compiler, Object, Object).

指定者:
AbstractAnnotationProcessorManager 中的 configure
参数:
batchCompiler - the given batch compiler object
options - the given options

configureFromPlatform

public void configureFromPlatform(Compiler compiler,
                                  Object compilationUnitLocator,
                                  Object javaProject)
从类 AbstractAnnotationProcessorManager 复制的描述
Configure the receiver using the given compiler, the given compilationUnitLocator and the given java project.

指定者:
AbstractAnnotationProcessorManager 中的 configureFromPlatform
参数:
compiler - the given compiler
compilationUnitLocator - the given compilation unit locator
javaProject - the given java project

getDiscoveredProcessors

public List<ProcessorInfo> getDiscoveredProcessors()
指定者:
接口 IProcessorProvider 中的 getDiscoveredProcessors
返回:
the list of all processors that have been discovered so far. This list will grow when IProcessorProvider.discoverNextProcessor() is called.

getDeletedUnits

public ICompilationUnit[] getDeletedUnits()
从类 AbstractAnnotationProcessorManager 复制的描述
Returns the deleted units.

指定者:
AbstractAnnotationProcessorManager 中的 getDeletedUnits
返回:
the deleted units

getNewUnits

public ICompilationUnit[] getNewUnits()
从类 AbstractAnnotationProcessorManager 复制的描述
Return the new units created in the last round.

指定者:
AbstractAnnotationProcessorManager 中的 getNewUnits
返回:
the new units created in the last round

getNewClassFiles

public ReferenceBinding[] getNewClassFiles()
从类 AbstractAnnotationProcessorManager 复制的描述
Return the new binary bindings created in the last round.

指定者:
AbstractAnnotationProcessorManager 中的 getNewClassFiles
返回:
the new binary bindings created in the last round

reset

public void reset()
从类 AbstractAnnotationProcessorManager 复制的描述
Reinitialize the receiver

指定者:
AbstractAnnotationProcessorManager 中的 reset

setErr

public void setErr(PrintWriter err)
从类 AbstractAnnotationProcessorManager 复制的描述
Set the print writer for the standard error.

指定者:
AbstractAnnotationProcessorManager 中的 setErr
参数:
err - the given print writer for error

setOut

public void setOut(PrintWriter out)
从类 AbstractAnnotationProcessorManager 复制的描述
Set the print writer for the standard output.

指定者:
AbstractAnnotationProcessorManager 中的 setOut
参数:
out - the given print writer for output

setProcessors

public void setProcessors(Object[] processors)
从类 AbstractAnnotationProcessorManager 复制的描述
Set the processors for annotation processing.

指定者:
AbstractAnnotationProcessorManager 中的 setProcessors
参数:
processors - the given processors

processAnnotations

public void processAnnotations(CompilationUnitDeclaration[] units,
                               ReferenceBinding[] referenceBindings,
                               boolean isLastRound)
A single "round" of processing, in the sense implied in javax.lang.annotation.processing.Processor.

The Java 6 Processor spec contains ambiguities about how processors that support "*" are handled. Eclipse tries to match Sun's implementation in javac. What that actually does is analogous to inspecting the set of annotions found in the root units and adding an "imaginary" annotation if the set is empty. Processors are then called in order of discovery; for each processor, the intersection between the set of root annotations and the set of annotations the processor supports is calculated, and if it is non-empty, the processor is called. If the processor returns true then the intersection (including the imaginary annotation if one exists) is removed from the set of root annotations and the loop continues, until the set is empty. Of course, the imaginary annotation is not actually included in the set of annotations passed in to the processor. A processor's process() method is not called until its intersection set is non-empty, but thereafter it is called on every round. Note that even if a processor is not called in the first round, if it is called in subsequent rounds, it will be called in the order in which the processors were discovered, rather than being added to the end of the list.

指定者:
AbstractAnnotationProcessorManager 中的 processAnnotations
参数:
units - the given source type
referenceBindings - the given binary types
isLastRound - flag to notify the last round


Copyright © 2013. All Rights Reserved.