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 AnnotatedTypeScanner<R,P> extends Object implements AnnotatedTypeVisitor<R,P>
The default implementation of the visitXYZ methods will determine a result as follows:
class CountTypeVariable extends TreeScanner {
@Override
public Integer visitTypeVariable(ATypeVariable node, Void p) {
return 1;
}
@Override
public Integer reduce(Integer r1, Integer r2) {
return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2);
}
}
Modifier and Type | Field and Description |
---|---|
protected Map<AnnotatedTypeMirror,R> |
visitedNodes |
Constructor and Description |
---|
AnnotatedTypeScanner() |
Modifier and Type | Method and Description |
---|---|
protected R |
reduce(R r1,
R r2) |
void |
reset()
Reset the scanner to allow reuse of the same instance.
|
protected R |
scan(AnnotatedTypeMirror type,
P p)
Processes an element by calling e.accept(this, p); this method may be overridden by
subclasses.
|
protected R |
scan(Iterable<? extends AnnotatedTypeMirror> types,
P p)
Processes an element by calling e.accept(this, p); this method may be overridden by
subclasses.
|
R |
scanAndReduce(AnnotatedTypeMirror type,
P p,
R r) |
protected R |
scanAndReduce(Iterable<? extends AnnotatedTypeMirror> types,
P p,
R r) |
R |
visit(AnnotatedTypeMirror t)
A Convenience method equivalent to
v.visit(t, null) . |
R |
visit(AnnotatedTypeMirror type,
P p)
Visits a type.
|
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 |
visitIntersection(AnnotatedTypeMirror.AnnotatedIntersectionType type,
P p)
Visits an intersection 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 |
visitUnion(AnnotatedTypeMirror.AnnotatedUnionType type,
P p)
Visits an union type.
|
R |
visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType type,
P p)
Visits a wildcard type.
|
protected final Map<AnnotatedTypeMirror,R> visitedNodes
public void reset()
public final R visit(AnnotatedTypeMirror t)
AnnotatedTypeVisitor
v.visit(t, null)
.visit
in interface AnnotatedTypeVisitor<R,P>
t
- the type to visitpublic final R visit(AnnotatedTypeMirror type, P p)
AnnotatedTypeVisitor
visit
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameterprotected R scan(AnnotatedTypeMirror type, P p)
type
protected R scan(Iterable<? extends AnnotatedTypeMirror> types, P p)
protected R scanAndReduce(Iterable<? extends AnnotatedTypeMirror> types, P p, R r)
public R scanAndReduce(AnnotatedTypeMirror type, P p, R r)
public R visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType type, P p)
AnnotatedTypeVisitor
visitDeclared
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic R visitIntersection(AnnotatedTypeMirror.AnnotatedIntersectionType type, P p)
AnnotatedTypeVisitor
visitIntersection
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic R visitUnion(AnnotatedTypeMirror.AnnotatedUnionType type, P p)
AnnotatedTypeVisitor
visitUnion
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic R visitArray(AnnotatedTypeMirror.AnnotatedArrayType type, P p)
AnnotatedTypeVisitor
visitArray
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic R visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type, P p)
AnnotatedTypeVisitor
visitExecutable
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic R visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type, P p)
AnnotatedTypeVisitor
visitTypeVariable
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic R visitNoType(AnnotatedTypeMirror.AnnotatedNoType type, P p)
AnnotatedTypeVisitor
visitNoType
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic R visitNull(AnnotatedTypeMirror.AnnotatedNullType type, P p)
AnnotatedTypeVisitor
null
type.visitNull
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic R visitPrimitive(AnnotatedTypeMirror.AnnotatedPrimitiveType type, P p)
AnnotatedTypeVisitor
visitPrimitive
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameterpublic R visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType type, P p)
AnnotatedTypeVisitor
visitWildcard
in interface AnnotatedTypeVisitor<R,P>
type
- the type to visitp
- a visitor-specified parameter