|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object checkers.types.AnnotatedTypeMirror
public abstract class AnnotatedTypeMirror
Represents a annotated type in the JSR308 Java programming language. Types
include primitive types, declared types (class and interface types), array
types, type variables, and the null type. Also represented are wildcard type
arguments, the signature and return types of executables, and pseudo-types
corresponding to packages and to the keyword void.
Types should be compared using the utility methods in
AnnotatedTypes
. There is no guarantee that any
particular type will always be represented by the same object.
To implement operations based on the class of an TypeMirror object, either
use a visitor or use the result of the getKind()
method.
Nested Class Summary | |
---|---|
static class |
AnnotatedTypeMirror.AnnotatedArrayType
Represents Array types in java. |
static class |
AnnotatedTypeMirror.AnnotatedDeclaredType
Represents a declared type (whether class or interface). |
static class |
AnnotatedTypeMirror.AnnotatedExecutableType
Represents a type of an executable. |
static class |
AnnotatedTypeMirror.AnnotatedNoType
A pseudo-type used where no actual type is appropriate. |
static class |
AnnotatedTypeMirror.AnnotatedNullType
Represents the null type. |
static class |
AnnotatedTypeMirror.AnnotatedPrimitiveType
Represents a primitive type. |
static interface |
AnnotatedTypeMirror.AnnotatedReferenceType
|
static class |
AnnotatedTypeMirror.AnnotatedTypeVariable
Represents a type variable. |
static class |
AnnotatedTypeMirror.AnnotatedWildcardType
Represents a wildcard type argument. |
Field Summary | |
---|---|
protected TypeMirror |
actualType
Actual type wrapped with this AnnotatedTypeMirror |
protected AnnotationUtils |
annotationFactory
The factory to use for lazily creating annotations. |
protected Set<AnnotationMirror> |
annotations
The annotations on this type. |
protected Element |
element
the Element associated with this instance value, if one exists |
protected AnnotatedTypeMirror |
enclosingType
The enclosing Type |
protected ProcessingEnvironment |
env
Processing Environment of the current round |
protected AnnotatedTypeFactory |
typeFactory
The factory to use for lazily creating annotated types. |
Method Summary | ||
---|---|---|
abstract
|
accept(AnnotatedTypeVisitor<R,P> v,
P p)
Applies a visitor to this type. |
|
void |
addAnnotation(AnnotationMirror a)
Adds an annotation to this type. |
|
void |
addAnnotations(Iterable<? extends AnnotationMirror> annotations)
Adds multiple annotations to this type. |
|
void |
clearAnnotations()
Removes all annotations on this type |
|
protected AnnotatedTypeMirror |
copyFields(AnnotatedTypeMirror type,
boolean annotation)
Copy the fields on this type onto the passed type. |
|
static AnnotatedTypeMirror |
createType(TypeMirror type,
ProcessingEnvironment env,
AnnotatedTypeFactory typeFactory)
Creates the appropriate AnnotatedTypeMirror specific wrapper for the provided type |
|
protected AnnotatedTypeMirror.AnnotatedDeclaredType |
createTypeOfObject()
|
|
List<? extends AnnotatedTypeMirror> |
directSuperTypes()
|
|
protected List<AnnotatedTypeMirror.AnnotatedDeclaredType> |
directSuperTypes(AnnotatedTypeMirror.AnnotatedDeclaredType type)
|
|
boolean |
equals(Object o)
|
|
protected static String |
formatAnnotationString(Collection<? extends AnnotationMirror> lst)
|
|
AnnotationMirror |
getAnnotation(Name annotationName)
|
|
AnnotationMirror |
getAnnotation(String annotationName)
Returns the actual annotation mirror used to annotate this type, whose name equals the passed annotationName if one exist, null otherwise. |
|
Set<AnnotationMirror> |
getAnnotations()
Returns the annotations on this type. |
|
abstract AnnotatedTypeMirror |
getCopy(boolean annotation)
Returns a shallow copy of this type. |
|
Element |
getElement()
Returns the element associated with the value the type represent, if any. |
|
AnnotatedTypeMirror |
getEnclosingType()
Returns the enclosing type, as in the type of A in the type
A.B . |
|
AnnotatedTypeMirror |
getErased()
Returns the erasure type of the this type, according to JLS specifications. |
|
TypeKind |
getKind()
Returns the kind of this type |
|
TypeMirror |
getUnderlyingType()
Returns the underlying unannotated Java type wrapped with this |
|
boolean |
hasAnnotation(AnnotationMirror a)
Determines whether this type contains an annotation with the same annotation type as a particular annotation. |
|
int |
hashCode()
|
|
boolean |
removeAnnotation(AnnotationMirror a)
Removes an annotation from the type. |
|
boolean |
removeAnnotations(Iterable<? extends AnnotationMirror> annotations)
Removes multiple annotations from the type. |
|
AnnotatedTypeMirror |
substitute(Map<? extends AnnotatedTypeMirror,? extends AnnotatedTypeMirror> mappings)
Sub |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final ProcessingEnvironment env
protected final AnnotationUtils annotationFactory
protected final AnnotatedTypeFactory typeFactory
protected final TypeMirror actualType
protected Element element
protected AnnotatedTypeMirror enclosingType
protected final Set<AnnotationMirror> annotations
Method Detail |
---|
public static AnnotatedTypeMirror createType(TypeMirror type, ProcessingEnvironment env, AnnotatedTypeFactory typeFactory)
type
- env
- typeFactory
-
public List<? extends AnnotatedTypeMirror> directSuperTypes()
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public abstract <R,P> R accept(AnnotatedTypeVisitor<R,P> v, P p)
R
- the return type of the visitor's methodsP
- the type of the additional parameter to the visitor's methodsv
- the visitor operating on this typep
- additional parameter to the visitor
public TypeKind getKind()
kind
of this type
public TypeMirror getUnderlyingType()
public AnnotatedTypeMirror getEnclosingType()
A
in the type
A.B
.
public Set<AnnotationMirror> getAnnotations()
public AnnotationMirror getAnnotation(String annotationName)
annotationName
-
public AnnotationMirror getAnnotation(Name annotationName)
public boolean hasAnnotation(AnnotationMirror a)
a
- the annotation to check for
a
public void addAnnotation(AnnotationMirror a)
TypeQualifier
meta-annotation, this method has no effect.
a
- the annotation to addpublic void addAnnotations(Iterable<? extends AnnotationMirror> annotations)
annotations
- the annotations to addpublic boolean removeAnnotation(AnnotationMirror a)
a
- the annotation to remove
public boolean removeAnnotations(Iterable<? extends AnnotationMirror> annotations)
annotations
- the annotations to remove
public void clearAnnotations()
protected static final String formatAnnotationString(Collection<? extends AnnotationMirror> lst)
public String toString()
toString
in class Object
public Element getElement()
Element
of the value of this type, if one existspublic AnnotatedTypeMirror getErased()
protected AnnotatedTypeMirror copyFields(AnnotatedTypeMirror type, boolean annotation)
AnnotatedTypeMirror
type
- an empty type where fields of this are copied toannotation
- whether annotations are copied or notpublic abstract AnnotatedTypeMirror getCopy(boolean annotation)
annotation
- whether copy should have annotationsprotected AnnotatedTypeMirror.AnnotatedDeclaredType createTypeOfObject()
public AnnotatedTypeMirror substitute(Map<? extends AnnotatedTypeMirror,? extends AnnotatedTypeMirror> mappings)
mappings
- protected final List<AnnotatedTypeMirror.AnnotatedDeclaredType> directSuperTypes(AnnotatedTypeMirror.AnnotatedDeclaredType type)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |