org.eclipse.jdt.internal.compiler.apt.dispatch
Class ProcessorInfo

java.lang.Object
  extended by org.eclipse.jdt.internal.compiler.apt.dispatch.ProcessorInfo

public class ProcessorInfo
extends Object

Cached information associated with a Processor in the context of annotation processor dispatch.

This class supports inclusion in a collection by implementing equals() and hashCode(). Its concept of identity is based on the class object of the Processor that it wraps; so, for instance, it is not possible to have a Set that contains more than one instance of a particular Processor class. In fact, it is possible to have more than one instance of a Processor if there are multiple build threads, but within the context of a particular dispatch manager, there will only be one of any given Processor class.


Constructor Summary
ProcessorInfo(Processor p)
          Create a ProcessorInfo wrapping a particular Processor.
 
Method Summary
 boolean computeSupportedAnnotations(Set<TypeElement> annotations, Set<TypeElement> result)
          Compute the subset of annotations that are described by annotationTypes, and determine whether the processor should be called.
 boolean equals(Object obj)
           
 String getSupportedAnnotationTypesAsString()
           
 int hashCode()
           
 void reset()
          Must be called at the beginning of a build to ensure that no information is carried over from the previous build.
 boolean supportsStar()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessorInfo

public ProcessorInfo(Processor p)
Create a ProcessorInfo wrapping a particular Processor. The Processor must already have been initialized (that is, Processor.init(javax.annotation.processing.ProcessingEnvironment) must already have been called). Its getSupportedXXX() methods will be called and the results will be cached.

Method Detail

computeSupportedAnnotations

public boolean computeSupportedAnnotations(Set<TypeElement> annotations,
                                           Set<TypeElement> result)
Compute the subset of annotations that are described by annotationTypes, and determine whether the processor should be called. A processor will be called if it has any annotations to process, or if it supports "*", or if it was called in a previous round. If the return value of this method is true once for a given processor, then it will always be true on subsequent calls.

Parameters:
annotations - a set of annotation types
annotationTypes - a set of names, which may use the wildcard "*", as described in Processor.getSupportedAnnotationTypes().
result - an empty modifiable set, which upon return will contain a subset of annotations, which may be empty but will not be null.
Returns:
true if the processor should be called on this round.

supportsStar

public boolean supportsStar()
Returns:
true if the processor included "*" among its list of supported annotations.

reset

public void reset()
Must be called at the beginning of a build to ensure that no information is carried over from the previous build. In particular, processors are required to be called on every round after the round in which they are first called; this method resets the "has been called" flag.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

getSupportedAnnotationTypesAsString

public String getSupportedAnnotationTypesAsString()
Returns:
a string representing the set of supported annotation types, in a format suitable for debugging. The format is unspecified and subject to change.


Copyright © 2012. All Rights Reserved.