Class SimpleAnnotatedTypeScanner<R,P>
- java.lang.Object
-
- org.checkerframework.framework.type.visitor.AnnotatedTypeScanner<R,P>
-
- org.checkerframework.framework.type.visitor.SimpleAnnotatedTypeScanner<R,P>
-
- Type Parameters:
R
- the return type of this visitor's methods. Use Void for visitors that do not need to return results.P
- the type of the additional parameter to this visitor's methods. Use Void for visitors that do not need an additional parameter.
- All Implemented Interfaces:
AnnotatedTypeVisitor<R,P>
- Direct Known Subclasses:
HashcodeAtmVisitor
public class SimpleAnnotatedTypeScanner<R,P> extends AnnotatedTypeScanner<R,P>
AnAnnotatedTypeScanner
that scans anAnnotatedTypeMirror
and performs somedefaultAction
on each type. The defaultAction can be passed to the constructorSimpleAnnotatedTypeScanner(DefaultAction)
or this class can be extended anddefaultAction
can be overridden.If the default action does not return a result, then
R
should beVoid
. If the default action returns a result, then specify aAnnotatedTypeScanner.reduce(R, R)
function.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SimpleAnnotatedTypeScanner.DefaultAction<R,P>
Represents an action to perform on every type.-
Nested classes/interfaces inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
AnnotatedTypeScanner.Reduce<R>
-
-
Field Summary
Fields Modifier and Type Field Description protected SimpleAnnotatedTypeScanner.DefaultAction<R,P>
defaultAction
The action to perform on every type.-
Fields inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
defaultResult, reduceFunction, visitedNodes
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleAnnotatedTypeScanner()
Creates a scanner without specifying the default action.protected
SimpleAnnotatedTypeScanner(AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult)
Creates a scanner without specifying the default action.SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R,P> defaultAction)
Creates a scanner that performsdefaultAction
on every type.SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R,P> defaultAction, AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult)
Creates a scanner that performsdefaultAction
on every type and usereduce
to combine the results.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected R
defaultAction(AnnotatedTypeMirror type, P p)
Called by default for any visit method that is not overridden.R
visitArray(AnnotatedTypeMirror.AnnotatedArrayType type, P p)
Visits an array type.R
visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType type, P p)
Visits a declared type.R
visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type, P p)
Visits an executable type.R
visitNoType(AnnotatedTypeMirror.AnnotatedNoType type, P p)
Visits NoType type.R
visitNull(AnnotatedTypeMirror.AnnotatedNullType type, P p)
Visits anull
type.R
visitPrimitive(AnnotatedTypeMirror.AnnotatedPrimitiveType type, P p)
Visits a primitive type.R
visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type, P p)
Visits a type variable.R
visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType type, P p)
Visits a wildcard type.-
Methods inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
reduce, reset, scan, scan, scanAndReduce, scanAndReduce, visit, visit, visitIntersection, visitUnion
-
-
-
-
Field Detail
-
defaultAction
protected final SimpleAnnotatedTypeScanner.DefaultAction<R,P> defaultAction
The action to perform on every type.
-
-
Constructor Detail
-
SimpleAnnotatedTypeScanner
public SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R,P> defaultAction)
Creates a scanner that performsdefaultAction
on every type.Use this constructor if the type of result of the default action is
Void
.- Parameters:
defaultAction
- action to perform on every type
-
SimpleAnnotatedTypeScanner
public SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R,P> defaultAction, AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult)
Creates a scanner that performsdefaultAction
on every type and usereduce
to combine the results.Use this constructor if the default action returns a result.
- Parameters:
defaultAction
- action to perform on every typereduce
- function used to combine resultsdefaultResult
- result to use by default
-
SimpleAnnotatedTypeScanner
protected SimpleAnnotatedTypeScanner()
Creates a scanner without specifying the default action. Subclasses may only use this constructor if they also overridedefaultAction(AnnotatedTypeMirror, Object)
.
-
SimpleAnnotatedTypeScanner
protected SimpleAnnotatedTypeScanner(AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult)
Creates a scanner without specifying the default action. Subclasses may only use this constructor if they also overridedefaultAction(AnnotatedTypeMirror, Object)
.- Parameters:
reduce
- function used to combine resultsdefaultResult
- result to use by default
-
-
Method Detail
-
defaultAction
protected R defaultAction(AnnotatedTypeMirror type, P p)
Called by default for any visit method that is not overridden.- Parameters:
type
- the type to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitDeclared
public final R visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType type, P p)
Visits a declared type.- Specified by:
visitDeclared
in interfaceAnnotatedTypeVisitor<R,P>
- Overrides:
visitDeclared
in classAnnotatedTypeScanner<R,P>
- Parameters:
type
- the type to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitExecutable
public final R visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type, P p)
Visits an executable type.- Specified by:
visitExecutable
in interfaceAnnotatedTypeVisitor<R,P>
- Overrides:
visitExecutable
in classAnnotatedTypeScanner<R,P>
- Parameters:
type
- the type to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitArray
public final R visitArray(AnnotatedTypeMirror.AnnotatedArrayType type, P p)
Visits an array type.- Specified by:
visitArray
in interfaceAnnotatedTypeVisitor<R,P>
- Overrides:
visitArray
in classAnnotatedTypeScanner<R,P>
- Parameters:
type
- the type to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitTypeVariable
public final R visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type, P p)
Visits a type variable.- Specified by:
visitTypeVariable
in interfaceAnnotatedTypeVisitor<R,P>
- Overrides:
visitTypeVariable
in classAnnotatedTypeScanner<R,P>
- Parameters:
type
- the type to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitPrimitive
public final R visitPrimitive(AnnotatedTypeMirror.AnnotatedPrimitiveType type, P p)
Visits a primitive type.- Specified by:
visitPrimitive
in interfaceAnnotatedTypeVisitor<R,P>
- Overrides:
visitPrimitive
in classAnnotatedTypeScanner<R,P>
- Parameters:
type
- the type to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitNoType
public final R visitNoType(AnnotatedTypeMirror.AnnotatedNoType type, P p)
Visits NoType type.- Specified by:
visitNoType
in interfaceAnnotatedTypeVisitor<R,P>
- Overrides:
visitNoType
in classAnnotatedTypeScanner<R,P>
- Parameters:
type
- the type to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitNull
public final R visitNull(AnnotatedTypeMirror.AnnotatedNullType type, P p)
Visits anull
type.- Specified by:
visitNull
in interfaceAnnotatedTypeVisitor<R,P>
- Overrides:
visitNull
in classAnnotatedTypeScanner<R,P>
- Parameters:
type
- the type to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitWildcard
public final R visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType type, P p)
Visits a wildcard type.- Specified by:
visitWildcard
in interfaceAnnotatedTypeVisitor<R,P>
- Overrides:
visitWildcard
in classAnnotatedTypeScanner<R,P>
- Parameters:
type
- the type to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
-