A visitor of program elements based on their {@linkplain
ElementKind kind} with default behavior appropriate for the
source version. For {@linkplain
Element elements}
method corresponding to the
first argument's kind. The
, passing their arguments
to {@code defaultAction}'s corresponding parameters.
Methods in this class may be overridden subject to their
general contract. Note that annotating methods in concrete
subclasses with @Override will help
ensure that methods are overridden as intended.
When such a new visit method is added, the default
implementation in this class will be to call the visitUnknown method. A new abstract element kind
visitor class will also be introduced to correspond to the new
language level; this visitor will have different default behavior
for the visit method in question. When the new visitor is
introduced, all or portions of this visitor may be deprecated.
| Method from javax.lang.model.util.ElementKindVisitor6 Detail: |
public R visitExecutable(ExecutableElement e,
P p) {
ElementKind k = e.getKind();
switch(k) {
case CONSTRUCTOR:
return visitExecutableAsConstructor(e, p);
case INSTANCE_INIT:
return visitExecutableAsInstanceInit(e, p);
case METHOD:
return visitExecutableAsMethod(e, p);
case STATIC_INIT:
return visitExecutableAsStaticInit(e, p);
default:
throw new AssertionError("Bad kind " + k + " for ExecutableElement" + e);
}
}
Visits an executable element, dispatching to the visit method
for the specific {@linkplain ElementKind kind} of executable,
{@code CONSTRUCTOR}, {@code INSTANCE_INIT}, {@code METHOD}, or
{@code STATIC_INIT}. |
public R visitExecutableAsConstructor(ExecutableElement e,
P p) {
return defaultAction(e, p);
}
Visits a {@code CONSTRUCTOR} executable element by calling
{@code defaultAction}. |
public R visitExecutableAsInstanceInit(ExecutableElement e,
P p) {
return defaultAction(e, p);
}
Visits an {@code INSTANCE_INIT} executable element by calling
{@code defaultAction}. |
public R visitExecutableAsMethod(ExecutableElement e,
P p) {
return defaultAction(e, p);
}
Visits a {@code METHOD} executable element by calling
{@code defaultAction}. |
public R visitExecutableAsStaticInit(ExecutableElement e,
P p) {
return defaultAction(e, p);
}
Visits a {@code STATIC_INIT} executable element by calling
{@code defaultAction}. |
public R visitPackage(PackageElement e,
P p) {
assert e.getKind() == PACKAGE: "Bad kind on PackageElement";
return defaultAction(e, p);
}
{@inheritDoc}
The element argument has kind {@code PACKAGE}. |
public R visitType(TypeElement e,
P p) {
ElementKind k = e.getKind();
switch(k) {
case ANNOTATION_TYPE:
return visitTypeAsAnnotationType(e, p);
case CLASS:
return visitTypeAsClass(e, p);
case ENUM:
return visitTypeAsEnum(e, p);
case INTERFACE:
return visitTypeAsInterface(e, p);
default:
throw new AssertionError("Bad kind " + k + " for TypeElement" + e);
}
}
Visits a type element, dispatching to the visit method for the
specific {@linkplain ElementKind kind} of type, {@code
ANNOTATION_TYPE}, {@code CLASS}, {@code ENUM}, or {@code
INTERFACE}. |
public R visitTypeAsAnnotationType(TypeElement e,
P p) {
return defaultAction(e, p);
}
Visits an {@code ANNOTATION_TYPE} type element by calling
{@code defaultAction}. |
public R visitTypeAsClass(TypeElement e,
P p) {
return defaultAction(e, p);
}
Visits a {@code CLASS} type element by calling {@code
defaultAction}. |
public R visitTypeAsEnum(TypeElement e,
P p) {
return defaultAction(e, p);
}
Visits an {@code ENUM} type element by calling {@code
defaultAction}. |
public R visitTypeAsInterface(TypeElement e,
P p) {
return defaultAction(e, p);
}
Visits an {@code INTERFACE} type element by calling {@code
defaultAction}.
. |
public R visitTypeParameter(TypeParameterElement e,
P p) {
assert e.getKind() == TYPE_PARAMETER: "Bad kind on TypeParameterElement";
return defaultAction(e, p);
}
{@inheritDoc}
The element argument has kind {@code TYPE_PARAMETER}. |
public R visitVariable(VariableElement e,
P p) {
ElementKind k = e.getKind();
switch(k) {
case ENUM_CONSTANT:
return visitVariableAsEnumConstant(e, p);
case EXCEPTION_PARAMETER:
return visitVariableAsExceptionParameter(e, p);
case FIELD:
return visitVariableAsField(e, p);
case LOCAL_VARIABLE:
return visitVariableAsLocalVariable(e, p);
case PARAMETER:
return visitVariableAsParameter(e, p);
case RESOURCE_VARIABLE:
return visitVariableAsResourceVariable(e, p);
default:
throw new AssertionError("Bad kind " + k + " for VariableElement" + e);
}
}
Visits a variable element, dispatching to the visit method for
the specific {@linkplain ElementKind kind} of variable, {@code
ENUM_CONSTANT}, {@code EXCEPTION_PARAMETER}, {@code FIELD},
{@code LOCAL_VARIABLE}, {@code PARAMETER}, or {@code RESOURCE_VARIABLE}. |
public R visitVariableAsEnumConstant(VariableElement e,
P p) {
return defaultAction(e, p);
}
Visits an {@code ENUM_CONSTANT} variable element by calling
{@code defaultAction}. |
public R visitVariableAsExceptionParameter(VariableElement e,
P p) {
return defaultAction(e, p);
}
Visits an {@code EXCEPTION_PARAMETER} variable element by calling
{@code defaultAction}. |
public R visitVariableAsField(VariableElement e,
P p) {
return defaultAction(e, p);
}
Visits a {@code FIELD} variable element by calling
{@code defaultAction}. |
public R visitVariableAsLocalVariable(VariableElement e,
P p) {
return defaultAction(e, p);
}
Visits a {@code LOCAL_VARIABLE} variable element by calling
{@code defaultAction}. |
public R visitVariableAsParameter(VariableElement e,
P p) {
return defaultAction(e, p);
}
Visits a {@code PARAMETER} variable element by calling
{@code defaultAction}. |
public R visitVariableAsResourceVariable(VariableElement e,
P p) {
return visitUnknown(e, p);
}
Visits a {@code RESOURCE_VARIABLE} variable element by calling
{@code visitUnknown}. |