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.public class SimpleAnnotatedTypeScanner<R,P> extends AnnotatedTypeScanner<R,P>
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.
Modifier and Type | Class and Description |
---|---|
static interface |
SimpleAnnotatedTypeScanner.DefaultAction<R,P>
Represents an action to perform on every type.
|
AnnotatedTypeScanner.Reduce<R>
Modifier and Type | Field and Description |
---|---|
protected SimpleAnnotatedTypeScanner.DefaultAction<R,P> |
defaultAction
The action to perform on every type.
|
defaultResult, reduceFunction, visitedNodes
Modifier | Constructor and Description |
---|---|
protected |
SimpleAnnotatedTypeScanner()
Creates a scanner without specifing the default action.
|
protected |
SimpleAnnotatedTypeScanner(AnnotatedTypeScanner.Reduce<R> reduce,
R defaultResult)
Creates a scanner without specifing the default action.
|
|
SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R,P> defaultAction)
Creates a scanner that performs
defaultAction on every type. |
|
SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R,P> defaultAction,
AnnotatedTypeScanner.Reduce<R> reduce,
R defaultResult)
Creates a scanner that performs
defaultAction on every type and use reduce to
combine the results. |
Modifier and Type | Method and 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 a
null 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.
|
reduce, reset, scan, scan, scanAndReduce, scanAndReduce, visit, visit, visitIntersection, visitUnion
protected final SimpleAnnotatedTypeScanner.DefaultAction<R,P> defaultAction
public SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R,P> defaultAction)
defaultAction
on every type.
Use this constructor if the type of result of the default action is Void
.
defaultAction
- action to perform on every typepublic SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R,P> defaultAction, AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult)
defaultAction
on every type and use reduce
to
combine the results.
Use this constructor if the default action returns a result.
defaultAction
- action to perform on every typereduce
- function used to combine resultsdefaultResult
- result to use by defaultprotected SimpleAnnotatedTypeScanner()
defaultAction(AnnotatedTypeMirror, Object)
.protected SimpleAnnotatedTypeScanner(AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult)
defaultAction(AnnotatedTypeMirror, Object)
.reduce
- function used to combine resultsdefaultResult
- result to use by defaultprotected R defaultAction(AnnotatedTypeMirror type, P p)
type
- the type to visitp
- a visitor-specified parameterpublic final R visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType type, P p)
visitDeclared
in interface AnnotatedTypeVisitor<R,P>
visitDeclared
in class AnnotatedTypeScanner<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic final R visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type, P p)
visitExecutable
in interface AnnotatedTypeVisitor<R,P>
visitExecutable
in class AnnotatedTypeScanner<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic final R visitArray(AnnotatedTypeMirror.AnnotatedArrayType type, P p)
visitArray
in interface AnnotatedTypeVisitor<R,P>
visitArray
in class AnnotatedTypeScanner<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic final R visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type, P p)
visitTypeVariable
in interface AnnotatedTypeVisitor<R,P>
visitTypeVariable
in class AnnotatedTypeScanner<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic final R visitPrimitive(AnnotatedTypeMirror.AnnotatedPrimitiveType type, P p)
visitPrimitive
in interface AnnotatedTypeVisitor<R,P>
visitPrimitive
in class AnnotatedTypeScanner<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic final R visitNoType(AnnotatedTypeMirror.AnnotatedNoType type, P p)
visitNoType
in interface AnnotatedTypeVisitor<R,P>
visitNoType
in class AnnotatedTypeScanner<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic final R visitNull(AnnotatedTypeMirror.AnnotatedNullType type, P p)
null
type.visitNull
in interface AnnotatedTypeVisitor<R,P>
visitNull
in class AnnotatedTypeScanner<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic final R visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType type, P p)
visitWildcard
in interface AnnotatedTypeVisitor<R,P>
visitWildcard
in class AnnotatedTypeScanner<R,P>
type
- the type to visitp
- a visitor-specified parameter