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 extends @Nullable Object,P extends @Nullable Object> extends @Nullable Object implements AnnotatedTypeVisitor<R,P>
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<@Mutable AnnotatedTypeMirror,R> |
visitedNodes |
Constructor and Description |
---|
AnnotatedTypeScanner() |
Modifier and Type | Method and Description |
---|---|
protected R |
reduce(R r1,
R r2) |
protected R |
scan(@Mutable 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 @Mutable AnnotatedTypeMirror> types,
P p)
Processes an element by calling e.accept(this, p); this method
may be overridden by subclasses.
|
R |
scanAndReduce(@Mutable AnnotatedTypeMirror type,
P p,
R r) |
protected R |
scanAndReduce(Iterable<? extends @Mutable AnnotatedTypeMirror> types,
P p,
R r) |
R |
visit(@Mutable AnnotatedTypeMirror t)
A Convenience method equivalent to
v.visit(t, null) . |
R |
visit(@Mutable 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 |
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.
|
public final R visit(@Mutable AnnotatedTypeMirror t)
AnnotatedTypeVisitor
v.visit(t, null)
.public final R visit(@Mutable AnnotatedTypeMirror type, P p)
AnnotatedTypeVisitor
protected R scan(@Mutable AnnotatedTypeMirror type, P p)
type
protected R scan(Iterable<? extends @Mutable AnnotatedTypeMirror> types, P p)
types
- p
- protected R scanAndReduce(Iterable<? extends @Mutable AnnotatedTypeMirror> types, P p, R r)
public R scanAndReduce(@Mutable AnnotatedTypeMirror type, P p, R r)
public R visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType type, P p)
AnnotatedTypeVisitor
visitDeclared
in interface AnnotatedTypeVisitor<R extends @Nullable Object,P extends @Nullable Object>
type
- the type to visitp
- a visitor-specified parameterpublic R visitArray(AnnotatedTypeMirror.AnnotatedArrayType type, P p)
AnnotatedTypeVisitor
visitArray
in interface AnnotatedTypeVisitor<R extends @Nullable Object,P extends @Nullable Object>
type
- the type to visitp
- a visitor-specified parameterpublic R visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type, P p)
AnnotatedTypeVisitor
visitExecutable
in interface AnnotatedTypeVisitor<R extends @Nullable Object,P extends @Nullable Object>
type
- the type to visitp
- a visitor-specified parameterpublic R visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type, P p)
AnnotatedTypeVisitor
visitTypeVariable
in interface AnnotatedTypeVisitor<R extends @Nullable Object,P extends @Nullable Object>
type
- the type to visitp
- a visitor-specified parameterpublic R visitNoType(AnnotatedTypeMirror.AnnotatedNoType type, P p)
AnnotatedTypeVisitor
visitNoType
in interface AnnotatedTypeVisitor<R extends @Nullable Object,P extends @Nullable Object>
type
- the type to visitp
- a visitor-specified parameterpublic R visitNull(AnnotatedTypeMirror.AnnotatedNullType type, P p)
AnnotatedTypeVisitor
null
type.public R visitPrimitive(AnnotatedTypeMirror.AnnotatedPrimitiveType type, P p)
AnnotatedTypeVisitor
visitPrimitive
in interface AnnotatedTypeVisitor<R extends @Nullable Object,P extends @Nullable Object>
type
- the type to visitp
- a visitor-specified parameterpublic R visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType type, P p)
AnnotatedTypeVisitor
visitWildcard
in interface AnnotatedTypeVisitor<R extends @Nullable Object,P extends @Nullable Object>
type
- the type to visitp
- a visitor-specified parameter