public class DefaultForTypeAnnotator extends TypeAnnotator
DefaultFor
; it is designed to be used in a ListTypeAnnotator
constructed in
GenericAnnotatedTypeFactory.createTypeAnnotator()
()}
DefaultForTypeAnnotator
traverses types deeply.
This class takes care of two of the attributes of DefaultFor
; the others are handled
in QualifierDefaults
.
ListTypeAnnotator
AnnotatedTypeScanner.Reduce<R>
typeFactory
defaultResult, reduceFunction, visitedNodes
Constructor and Description |
---|
DefaultForTypeAnnotator(AnnotatedTypeFactory typeFactory)
Creates a
DefaultForTypeAnnotator from the given checker, using that checker to
determine the annotations that are in the type hierarchy. |
Modifier and Type | Method and Description |
---|---|
void |
addAtmClass(Class<? extends AnnotatedTypeMirror> typeClass,
AnnotationMirror theQual)
Add default qualifier,
theQual , for the given AnnotatedTypeMirror class. |
DefaultForTypeAnnotator |
addStandardDefaults()
Adds standard rules.
|
void |
addTypeKind(TypeKind typeKind,
AnnotationMirror theQual)
Add default qualifier,
theQual , for the given TypeKind. |
void |
addTypes(Class<?> clazz,
AnnotationMirror theQual)
Add default qualifier,
theQual , for the given type. |
void |
defaultTypeFromName(AnnotatedTypeMirror type,
String name)
Apply defaults based on a variable name to a type.
|
protected Void |
scan(AnnotatedTypeMirror type,
Void p)
Scan
type by calling type.accept(this, p) ; this method may be overridden by
subclasses. |
Void |
visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type,
Void aVoid)
Visits an executable type.
|
reduce, reset, scan, scanAndReduce, scanAndReduce, visit, visit, visitArray, visitDeclared, visitIntersection, visitNoType, visitNull, visitPrimitive, visitTypeVariable, visitUnion, visitWildcard
public DefaultForTypeAnnotator(AnnotatedTypeFactory typeFactory)
DefaultForTypeAnnotator
from the given checker, using that checker to
determine the annotations that are in the type hierarchy.public void addTypeKind(TypeKind typeKind, AnnotationMirror theQual)
theQual
, for the given TypeKind.public void addAtmClass(Class<? extends AnnotatedTypeMirror> typeClass, AnnotationMirror theQual)
theQual
, for the given AnnotatedTypeMirror
class.public void addTypes(Class<?> clazz, AnnotationMirror theQual)
theQual
, for the given type.protected Void scan(AnnotatedTypeMirror type, Void p)
AnnotatedTypeScanner
type
by calling type.accept(this, p)
; this method may be overridden by
subclasses.scan
in class AnnotatedTypeScanner<Void,Void>
type
- type to scanp
- the parameter to usetype
public DefaultForTypeAnnotator addStandardDefaults()
LiteralTreeAnnotator.addStandardLiteralQualifiers()
.public void defaultTypeFromName(AnnotatedTypeMirror type, String name)
type
- a type to apply defaults toname
- the name of the variable that has type type
, or the name of the method
whose return type is type
public Void visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type, Void aVoid)
TypeAnnotator
If this method adds annotations to the type of method parameters, then GenericAnnotatedTypeFactory.addComputedTypeAnnotations(Element,
AnnotatedTypeMirror)
should be overriden and the same annotations added to the type of
elements with kind ElementKind.PARAMETER
. Likewise for return
types.
visitExecutable
in interface AnnotatedTypeVisitor<Void,Void>
visitExecutable
in class TypeAnnotator
type
- the type to visitaVoid
- a visitor-specified parameter