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.
ListTypeAnnotatorAnnotatedTypeScanner.Reduce<R>typeFactorydefaultResult, 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, visitWildcardpublic 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)
AnnotatedTypeScannertype 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 usetypepublic 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 typepublic Void visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type, Void aVoid)
TypeAnnotatorIf 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 TypeAnnotatortype - the type to visitaVoid - a visitor-specified parameter