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
An
AnnotatedTypeScanner
that scans an AnnotatedTypeMirror
and performs some
defaultAction
on each type. The defaultAction can be passed to the constructor SimpleAnnotatedTypeScanner(DefaultAction)
or this class can be extended and defaultAction
can be overridden.
If the default action does not return a result, then R
should be Void
. If the
default action returns a result, then specify a AnnotatedTypeScanner.reduce(R, R)
function.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
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
FieldsModifier and TypeFieldDescriptionprotected final SimpleAnnotatedTypeScanner.DefaultAction<R,
P> The action to perform on every type.Fields inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
defaultResult, reduceFunction, visitedNodes
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
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
Modifier and TypeMethodDescriptionprotected R
defaultAction
(AnnotatedTypeMirror type, P p) Called by default for any visit method that is not overridden.final R
Visits an array type.final R
Visits a declared type.final R
Visits an executable type.final R
Visits NoType type.final R
Visits anull
type.final R
Visits a primitive type.final R
Visits a type variable.final R
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 Details
-
defaultAction
The action to perform on every type.
-
-
Constructor Details
-
SimpleAnnotatedTypeScanner
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
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 Details
-
defaultAction
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
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
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
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
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
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
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
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
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
-