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.TreeVisitor<R,P> public class SimpleTreeVisitor<R,P> extends Object implements TreeVisitor<R,P>
| Modifier and Type | Field | Description |
|---|---|---|
protected final R |
DEFAULT_VALUE |
The default value, returned by the default action. |
| Modifier | Constructor | Description |
|---|---|---|
protected |
Creates a visitor, with a DEFAULT_VALUE of null. |
|
protected |
Creates a visitor, with a specified DEFAULT_VALUE. |
| Modifier and Type | Method | Description |
|---|---|---|
protected R |
defaultAction |
The default action, used by all visit methods that are not overridden. |
final R |
visit |
Invokes the appropriate visit method specific to the type of the node. |
final R |
visit |
Invokes the appropriate visit method on each of a sequence of nodes. |
R |
visitAnnotatedType |
Visits an AnnotatedTypeTree node. |
R |
visitAnnotation |
Visits an AnnotatedTree node. |
R |
visitAnyPattern |
Preview. Visits a AnyPatternTree node. |
R |
visitArrayAccess |
Visits an ArrayAccessTree node. |
R |
visitArrayType |
Visits an ArrayTypeTree node. |
R |
visitAssert |
Visits an AssertTree node. |
R |
visitAssignment |
Visits an AssignmentTree node. |
R |
visitBinary |
Visits a BinaryTree node. |
R |
visitBindingPattern |
Visits a BindingPatternTree node. |
R |
visitBlock |
Visits a BlockTree node. |
R |
visitBreak |
Visits a BreakTree node. |
R |
visitCase |
Visits a CaseTree node. |
R |
visitCatch |
Visits a CatchTree node. |
R |
visitClass |
Visits a ClassTree node. |
R |
visitCompilationUnit |
Visits a CompilationUnitTree node. |
R |
visitCompoundAssignment |
Visits a CompoundAssignmentTree node. |
R |
visitConditionalExpression |
Visits a ConditionalExpressionTree node. |
R |
visitConstantCaseLabel |
Visits a ConstantCaseLabelTree node. |
R |
visitContinue |
Visits a ContinueTree node. |
R |
visitDeconstructionPattern |
Visits a DeconstructionPatternTree node. |
R |
visitDefaultCaseLabel |
Visits a DefaultCaseLabelTree node. |
R |
visitDoWhileLoop |
Visits a DoWhileTree node. |
R |
visitEmptyStatement |
Visits an EmptyStatementTree node. |
R |
visitEnhancedForLoop |
Visits an EnhancedForLoopTree node. |
R |
visitErroneous |
Visits an ErroneousTree node. |
R |
visitExports |
Visits an ExportsTree node. |
R |
visitExpressionStatement |
Visits an ExpressionStatementTree node. |
R |
visitForLoop |
Visits a ForLoopTree node. |
R |
visitIdentifier |
Visits an IdentifierTree node. |
R |
visitIf |
Visits an IfTree node. |
R |
visitImport |
Visits an ImportTree node. |
R |
visitInstanceOf |
Visits an InstanceOfTree node. |
R |
visitIntersectionType |
Visits an IntersectionTypeTree node. |
R |
visitLabeledStatement |
Visits a LabeledStatementTree node. |
R |
visitLambdaExpression |
Visits a LambdaExpressionTree node. |
R |
visitLiteral |
Visits a LiteralTree node. |
R |
visitMemberReference |
Visits a MemberReferenceTree node. |
R |
visitMemberSelect |
Visits a MemberSelectTree node. |
R |
visitMethod |
Visits a MethodTree node. |
R |
visitMethodInvocation |
Visits a MethodInvocationTree node. |
R |
visitModifiers |
Visits a ModifiersTree node. |
R |
visitModule |
Visits a ModuleTree node. |
R |
visitNewArray |
Visits a NewArrayTree node. |
R |
visitNewClass |
Visits a NewClassTree node. |
R |
visitOpens |
Visits an OpensTree node. |
R |
visitOther |
Visits an unknown type of Tree node. |
R |
visitPackage |
Visits a PackageTree node. |
R |
visitParameterizedType |
Visits a ParameterizedTypeTree node. |
R |
visitParenthesized |
Visits a ParenthesizedTree node. |
R |
visitPatternCaseLabel |
Visits a PatternCaseLabelTree node. |
R |
visitPrimitiveType |
Visits a PrimitiveTypeTree node. |
R |
visitProvides |
Visits a ProvidesTree node. |
R |
visitRequires |
Visits a RequiresTree node. |
R |
visitReturn |
Visits a ReturnTree node. |
R |
visitStringTemplate |
Preview. Visits a StringTemplateTree node. |
R |
visitSwitch |
Visits a SwitchTree node. |
R |
visitSwitchExpression |
Visits a SwitchExpressionTree node. |
R |
visitSynchronized |
Visits a SynchronizedTree node. |
R |
visitThrow |
Visits a ThrowTree node. |
R |
visitTry |
Visits a TryTree node. |
R |
visitTypeCast |
Visits a TypeCastTree node. |
R |
visitTypeParameter |
Visits a TypeParameterTree node. |
R |
visitUnary |
Visits a UnaryTree node. |
R |
visitUnionType |
Visits a UnionTypeTree node. |
R |
visitUses |
Visits a UsesTree node. |
R |
visitVariable |
Visits a VariableTree node. |
R |
visitWhileLoop |
Visits a WhileLoopTree node. |
R |
visitWildcard |
Visits a WildcardTypeTree node. |
R |
visitYield |
Visits a YieldTree node. |
protected final R DEFAULT_VALUE
default action.protected SimpleTreeVisitor()
null.protected SimpleTreeVisitor(R defaultValue)
defaultValue - the default value to be returned by the default actionprotected R defaultAction(Tree node, P p)
node - the node being visitedp - the parameter value passed to the visit methodpublic final R visit(Tree node, P p)
node - the node on which to dispatchp - a parameter to be passed to the appropriate visit methodpublic final R visit(Iterable<? extends Tree> nodes, P p)
nodes - the nodes on which to dispatchp - a parameter value to be passed to each appropriate visit methodpublic R visitCompilationUnit(CompilationUnitTree node, P p)
CompilationUnitTree node.visitCompilationUnit in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitPackage(PackageTree node, P p)
PackageTree node.visitPackage in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitImport(ImportTree node, P p)
ImportTree node.visitImport in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitClass(ClassTree node, P p)
ClassTree node.visitClass in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitMethod(MethodTree node, P p)
MethodTree node.visitMethod in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitVariable(VariableTree node, P p)
VariableTree node.visitVariable in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitEmptyStatement(EmptyStatementTree node, P p)
EmptyStatementTree node.visitEmptyStatement in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitBlock(BlockTree node, P p)
BlockTree node.visitBlock in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitDoWhileLoop(DoWhileLoopTree node, P p)
DoWhileTree node.visitDoWhileLoop in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitWhileLoop(WhileLoopTree node, P p)
WhileLoopTree node.visitWhileLoop in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitForLoop(ForLoopTree node, P p)
ForLoopTree node.visitForLoop in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitEnhancedForLoop(EnhancedForLoopTree node, P p)
EnhancedForLoopTree node.visitEnhancedForLoop in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitLabeledStatement(LabeledStatementTree node, P p)
LabeledStatementTree node.visitLabeledStatement in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitSwitch(SwitchTree node, P p)
SwitchTree node.visitSwitch in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitSwitchExpression(SwitchExpressionTree node, P p)
SwitchExpressionTree node.visitSwitchExpression in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitCase(CaseTree node, P p)
CaseTree node.visitCase in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitSynchronized(SynchronizedTree node, P p)
SynchronizedTree node.visitSynchronized in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitTry(TryTree node, P p)
TryTree node.visitTry in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitCatch(CatchTree node, P p)
CatchTree node.visitCatch in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitConditionalExpression(ConditionalExpressionTree node, P p)
ConditionalExpressionTree node.visitConditionalExpression in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitIf(IfTree node, P p)
IfTree node.visitIf in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitExpressionStatement(ExpressionStatementTree node, P p)
ExpressionStatementTree node.visitExpressionStatement in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitBreak(BreakTree node, P p)
BreakTree node.visitBreak in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitContinue(ContinueTree node, P p)
ContinueTree node.visitContinue in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitReturn(ReturnTree node, P p)
ReturnTree node.visitReturn in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitThrow(ThrowTree node, P p)
ThrowTree node.visitThrow in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitAssert(AssertTree node, P p)
AssertTree node.visitAssert in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitMethodInvocation(MethodInvocationTree node, P p)
MethodInvocationTree node.visitMethodInvocation in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitNewClass(NewClassTree node, P p)
NewClassTree node.visitNewClass in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitNewArray(NewArrayTree node, P p)
NewArrayTree node.visitNewArray in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitLambdaExpression(LambdaExpressionTree node, P p)
LambdaExpressionTree node.visitLambdaExpression in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitParenthesized(ParenthesizedTree node, P p)
ParenthesizedTree node.visitParenthesized in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitAssignment(AssignmentTree node, P p)
AssignmentTree node.visitAssignment in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitCompoundAssignment(CompoundAssignmentTree node, P p)
CompoundAssignmentTree node.visitCompoundAssignment in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitUnary(UnaryTree node, P p)
UnaryTree node.visitUnary in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitBinary(BinaryTree node, P p)
BinaryTree node.visitBinary in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitTypeCast(TypeCastTree node, P p)
TypeCastTree node.visitTypeCast in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitInstanceOf(InstanceOfTree node, P p)
InstanceOfTree node.visitInstanceOf in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitStringTemplate(StringTemplateTreePREVIEW node, P p)
visitStringTemplate is a reflective preview API of the Java platform. defaultAction.visitStringTemplate in interface TreeVisitor<R,P>
node - the node being visitedp - a parameter valuedefaultAction
public R visitAnyPattern(AnyPatternTreePREVIEW node, P p)
visitAnyPattern is a preview API of the Java platform. visitAnyPattern when preview features are enabled.AnyPatternTree node.visitAnyPattern in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitBindingPattern(BindingPatternTree node, P p)
BindingPatternTree node.visitBindingPattern in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitDefaultCaseLabel(DefaultCaseLabelTree node, P p)
DefaultCaseLabelTree node.visitDefaultCaseLabel in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitConstantCaseLabel(ConstantCaseLabelTree node, P p)
ConstantCaseLabelTree node.visitConstantCaseLabel in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitDeconstructionPattern(DeconstructionPatternTree node, P p)
DeconstructionPatternTree node.visitDeconstructionPattern in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitPatternCaseLabel(PatternCaseLabelTree node, P p)
PatternCaseLabelTree node.visitPatternCaseLabel in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitArrayAccess(ArrayAccessTree node, P p)
ArrayAccessTree node.visitArrayAccess in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitMemberSelect(MemberSelectTree node, P p)
MemberSelectTree node.visitMemberSelect in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitMemberReference(MemberReferenceTree node, P p)
MemberReferenceTree node.visitMemberReference in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitIdentifier(IdentifierTree node, P p)
IdentifierTree node.visitIdentifier in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitLiteral(LiteralTree node, P p)
LiteralTree node.visitLiteral in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitPrimitiveType(PrimitiveTypeTree node, P p)
PrimitiveTypeTree node.visitPrimitiveType in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitArrayType(ArrayTypeTree node, P p)
ArrayTypeTree node.visitArrayType in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitParameterizedType(ParameterizedTypeTree node, P p)
ParameterizedTypeTree node.visitParameterizedType in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitUnionType(UnionTypeTree node, P p)
UnionTypeTree node.visitUnionType in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitIntersectionType(IntersectionTypeTree node, P p)
IntersectionTypeTree node.visitIntersectionType in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitTypeParameter(TypeParameterTree node, P p)
TypeParameterTree node.visitTypeParameter in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitWildcard(WildcardTree node, P p)
WildcardTypeTree node.visitWildcard in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitModifiers(ModifiersTree node, P p)
ModifiersTree node.visitModifiers in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitAnnotation(AnnotationTree node, P p)
AnnotatedTree node.visitAnnotation in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitAnnotatedType(AnnotatedTypeTree node, P p)
AnnotatedTypeTree node.visitAnnotatedType in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitModule(ModuleTree node, P p)
ModuleTree node.visitModule in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitExports(ExportsTree node, P p)
ExportsTree node.visitExports in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitOpens(OpensTree node, P p)
OpensTree node.visitOpens in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitProvides(ProvidesTree node, P p)
ProvidesTree node.visitProvides in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitRequires(RequiresTree node, P p)
RequiresTree node.visitRequires in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitUses(UsesTree node, P p)
UsesTree node.visitUses in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitErroneous(ErroneousTree node, P p)
ErroneousTree node.visitErroneous in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitOther(Tree node, P p)
Tree node. This can occur if the language evolves and new kinds of nodes are added to the Tree hierarchy.visitOther in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
public R visitYield(YieldTree node, P p)
YieldTree node.visitYield in interface TreeVisitor<R,P>
defaultAction.node - the node being visitedp - a parameter valuedefaultAction
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.compiler/com/sun/source/util/SimpleTreeVisitor.html