java.lang.Object
com.sun.source.util.SimpleTreeVisitor<R,P>
- Type Parameters:
R- the return type of this visitor's methods. UseVoidfor visitors that do not need to return results.P- the type of the additional parameter to this visitor's methods. UseVoidfor visitors that do not need an additional parameter.
- All Implemented Interfaces:
TreeVisitor<R,P>
public class SimpleTreeVisitor<R,P> extends Object implements TreeVisitor<R,P>
A simple visitor for tree nodes.
- Since:
- 1.6
-
Field Summary
Fields Modifier and Type Field Description protected RDEFAULT_VALUEThe default value, returned by thedefault action. -
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleTreeVisitor()Creates a visitor, with a DEFAULT_VALUE ofnull.protectedSimpleTreeVisitor(R defaultValue)Creates a visitor, with a specified DEFAULT_VALUE. -
Method Summary
Modifier and Type Method Description protected RdefaultAction(Tree node, P p)The default action, used by all visit methods that are not overridden.Rvisit(Tree node, P p)Invokes the appropriate visit method specific to the type of the node.Rvisit(Iterable<? extends Tree> nodes, P p)Invokes the appropriate visit method on each of a sequence of nodes.RvisitAnnotatedType(AnnotatedTypeTree node, P p)Visits an AnnotatedTypeTree node.RvisitAnnotation(AnnotationTree node, P p)Visits an AnnotatedTree node.RvisitArrayAccess(ArrayAccessTree node, P p)Visits an ArrayAccessTree node.RvisitArrayType(ArrayTypeTree node, P p)Visits an ArrayTypeTree node.RvisitAssert(AssertTree node, P p)Visits an AssertTree node.RvisitAssignment(AssignmentTree node, P p)Visits an AssignmentTree node.RvisitBinary(BinaryTree node, P p)Visits a BinaryTree node.RvisitBindingPattern(BindingPatternTree node, P p)Associated with pattern matching for instanceof, a preview feature of the Java language.
Visits an BindingPattern node.RvisitBlock(BlockTree node, P p)Visits a BlockTree node.RvisitBreak(BreakTree node, P p)Visits a BreakTree node.RvisitCase(CaseTree node, P p)Visits a CaseTree node.RvisitCatch(CatchTree node, P p)Visits a CatchTree node.RvisitClass(ClassTree node, P p)Visits a ClassTree node.RvisitCompilationUnit(CompilationUnitTree node, P p)Visits a CompilationUnitTree node.RvisitCompoundAssignment(CompoundAssignmentTree node, P p)Visits a CompoundAssignmentTree node.RvisitConditionalExpression(ConditionalExpressionTree node, P p)Visits a ConditionalExpressionTree node.RvisitContinue(ContinueTree node, P p)Visits a ContinueTree node.RvisitDoWhileLoop(DoWhileLoopTree node, P p)Visits a DoWhileTree node.RvisitEmptyStatement(EmptyStatementTree node, P p)Visits an EmptyStatementTree node.RvisitEnhancedForLoop(EnhancedForLoopTree node, P p)Visits an EnhancedForLoopTree node.RvisitExpressionStatement(ExpressionStatementTree node, P p)Visits an ExpressionStatementTree node.RvisitForLoop(ForLoopTree node, P p)Visits a ForLoopTree node.RvisitIdentifier(IdentifierTree node, P p)Visits an IdentifierTree node.RvisitIf(IfTree node, P p)Visits an IfTree node.RvisitImport(ImportTree node, P p)Visits an ImportTree node.RvisitInstanceOf(InstanceOfTree node, P p)Visits an InstanceOfTree node.RvisitIntersectionType(IntersectionTypeTree node, P p)Visits an IntersectionTypeTree node.RvisitLabeledStatement(LabeledStatementTree node, P p)Visits a LabeledStatementTree node.RvisitLambdaExpression(LambdaExpressionTree node, P p)Visits a LambdaExpressionTree node.RvisitLiteral(LiteralTree node, P p)Visits a LiteralTree node.RvisitMemberReference(MemberReferenceTree node, P p)Visits a MemberReferenceTree node.RvisitMemberSelect(MemberSelectTree node, P p)Visits a MemberSelectTree node.RvisitMethod(MethodTree node, P p)Visits a MethodTree node.RvisitMethodInvocation(MethodInvocationTree node, P p)Visits a MethodInvocationTree node.RvisitModifiers(ModifiersTree node, P p)Visits a ModifiersTree node.RvisitNewArray(NewArrayTree node, P p)Visits a NewArrayTree node.RvisitNewClass(NewClassTree node, P p)Visits a NewClassTree node.RvisitOther(Tree node, P p)Visits an unknown type of Tree node.RvisitPackage(PackageTree node, P p)Visits a PackageTree node.RvisitParameterizedType(ParameterizedTypeTree node, P p)Visits a ParameterizedTypeTree node.RvisitParenthesized(ParenthesizedTree node, P p)Visits a ParenthesizedTree node.RvisitPrimitiveType(PrimitiveTypeTree node, P p)Visits a PrimitiveTypeTree node.RvisitReturn(ReturnTree node, P p)Visits a ReturnTree node.RvisitSwitch(SwitchTree node, P p)Visits a SwitchTree node.RvisitSwitchExpression(SwitchExpressionTree node, P p)Visits a SwitchExpressionTree node.RvisitSynchronized(SynchronizedTree node, P p)Visits a SynchronizedTree node.RvisitThrow(ThrowTree node, P p)Visits a ThrowTree node.RvisitTry(TryTree node, P p)Visits a TryTree node.RvisitTypeCast(TypeCastTree node, P p)Visits a TypeCastTree node.RvisitTypeParameter(TypeParameterTree node, P p)Visits a TypeParameterTree node.RvisitUnary(UnaryTree node, P p)Visits a UnaryTree node.RvisitUnionType(UnionTypeTree node, P p)Visits a UnionTypeTree node.RvisitVariable(VariableTree node, P p)Visits a VariableTree node.RvisitWhileLoop(WhileLoopTree node, P p)Visits a WhileLoopTree node.RvisitWildcard(WildcardTree node, P p)Visits a WildcardTypeTree node.RvisitYield(YieldTree node, P p)Visits a YieldTree node.Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface com.sun.source.tree.TreeVisitor
visitErroneous, visitExports, visitModule, visitOpens, visitProvides, visitRequires, visitUses
-
Field Details
-
DEFAULT_VALUE
The default value, returned by thedefault action.
-
-
Constructor Details
-
SimpleTreeVisitor
protected SimpleTreeVisitor()Creates a visitor, with a DEFAULT_VALUE ofnull. -
SimpleTreeVisitor
Creates a visitor, with a specified DEFAULT_VALUE.- Parameters:
defaultValue- the default value to be returned by the default action.
-
-
Method Details
-
defaultAction
The default action, used by all visit methods that are not overridden.- Parameters:
node- the node being visitedp- the parameter value passed to the visit method- Returns:
- the result value to be returned from the visit method
-
visit
Invokes the appropriate visit method specific to the type of the node.- Parameters:
node- the node on which to dispatchp- a parameter to be passed to the appropriate visit method- Returns:
- the value returns from the appropriate visit method
-
visit
Invokes the appropriate visit method on each of a sequence of nodes.- Parameters:
nodes- the nodes on which to dispatchp- a parameter value to be passed to each appropriate visit method- Returns:
- the value return from the last of the visit methods, or null if none were called.
-
visitCompilationUnit
Visits a CompilationUnitTree node. This implementation callsdefaultAction.- Specified by:
visitCompilationUnitin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitPackage
Visits a PackageTree node. This implementation callsdefaultAction.- Specified by:
visitPackagein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitImport
Visits an ImportTree node. This implementation callsdefaultAction.- Specified by:
visitImportin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitClass
Visits a ClassTree node. This implementation callsdefaultAction.- Specified by:
visitClassin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitMethod
Visits a MethodTree node. This implementation callsdefaultAction.- Specified by:
visitMethodin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitVariable
Visits a VariableTree node. This implementation callsdefaultAction.- Specified by:
visitVariablein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitEmptyStatement
Visits an EmptyStatementTree node. This implementation callsdefaultAction.- Specified by:
visitEmptyStatementin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitBlock
Visits a BlockTree node. This implementation callsdefaultAction.- Specified by:
visitBlockin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitDoWhileLoop
Visits a DoWhileTree node. This implementation callsdefaultAction.- Specified by:
visitDoWhileLoopin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitWhileLoop
Visits a WhileLoopTree node. This implementation callsdefaultAction.- Specified by:
visitWhileLoopin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitForLoop
Visits a ForLoopTree node. This implementation callsdefaultAction.- Specified by:
visitForLoopin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitEnhancedForLoop
Visits an EnhancedForLoopTree node. This implementation callsdefaultAction.- Specified by:
visitEnhancedForLoopin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitLabeledStatement
Visits a LabeledStatementTree node. This implementation callsdefaultAction.- Specified by:
visitLabeledStatementin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitSwitch
Visits a SwitchTree node. This implementation callsdefaultAction.- Specified by:
visitSwitchin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitSwitchExpression
Visits a SwitchExpressionTree node. This implementation callsdefaultAction.- Specified by:
visitSwitchExpressionin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitCase
Visits a CaseTree node. This implementation callsdefaultAction.- Specified by:
visitCasein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitSynchronized
Visits a SynchronizedTree node. This implementation callsdefaultAction.- Specified by:
visitSynchronizedin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitTry
Visits a TryTree node. This implementation callsdefaultAction.- Specified by:
visitTryin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitCatch
Visits a CatchTree node. This implementation callsdefaultAction.- Specified by:
visitCatchin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitConditionalExpression
Visits a ConditionalExpressionTree node. This implementation callsdefaultAction.- Specified by:
visitConditionalExpressionin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitIf
Visits an IfTree node. This implementation callsdefaultAction.- Specified by:
visitIfin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitExpressionStatement
Visits an ExpressionStatementTree node. This implementation callsdefaultAction.- Specified by:
visitExpressionStatementin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitBreak
Visits a BreakTree node. This implementation callsdefaultAction.- Specified by:
visitBreakin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitContinue
Visits a ContinueTree node. This implementation callsdefaultAction.- Specified by:
visitContinuein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitReturn
Visits a ReturnTree node. This implementation callsdefaultAction.- Specified by:
visitReturnin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitThrow
Visits a ThrowTree node. This implementation callsdefaultAction.- Specified by:
visitThrowin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitAssert
Visits an AssertTree node. This implementation callsdefaultAction.- Specified by:
visitAssertin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitMethodInvocation
Visits a MethodInvocationTree node. This implementation callsdefaultAction.- Specified by:
visitMethodInvocationin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitNewClass
Visits a NewClassTree node. This implementation callsdefaultAction.- Specified by:
visitNewClassin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitNewArray
Visits a NewArrayTree node. This implementation callsdefaultAction.- Specified by:
visitNewArrayin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitLambdaExpression
Visits a LambdaExpressionTree node. This implementation callsdefaultAction.- Specified by:
visitLambdaExpressionin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitParenthesized
Visits a ParenthesizedTree node. This implementation callsdefaultAction.- Specified by:
visitParenthesizedin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitAssignment
Visits an AssignmentTree node. This implementation callsdefaultAction.- Specified by:
visitAssignmentin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitCompoundAssignment
Visits a CompoundAssignmentTree node. This implementation callsdefaultAction.- Specified by:
visitCompoundAssignmentin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitUnary
Visits a UnaryTree node. This implementation callsdefaultAction.- Specified by:
visitUnaryin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitBinary
Visits a BinaryTree node. This implementation callsdefaultAction.- Specified by:
visitBinaryin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitTypeCast
Visits a TypeCastTree node. This implementation callsdefaultAction.- Specified by:
visitTypeCastin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitInstanceOf
Visits an InstanceOfTree node. This implementation callsdefaultAction.- Specified by:
visitInstanceOfin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitBindingPattern
This method is associated with pattern matching for instanceof, a preview feature of the Java language. Preview features may be removed in a future release, or upgraded to permanent features of the Java language.
Visits an BindingPattern node. This implementation callsdefaultAction.- Specified by:
visitBindingPatternin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction - Since:
- 14
-
visitArrayAccess
Visits an ArrayAccessTree node. This implementation callsdefaultAction.- Specified by:
visitArrayAccessin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitMemberSelect
Visits a MemberSelectTree node. This implementation callsdefaultAction.- Specified by:
visitMemberSelectin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitMemberReference
Visits a MemberReferenceTree node. This implementation callsdefaultAction.- Specified by:
visitMemberReferencein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitIdentifier
Visits an IdentifierTree node. This implementation callsdefaultAction.- Specified by:
visitIdentifierin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitLiteral
Visits a LiteralTree node. This implementation callsdefaultAction.- Specified by:
visitLiteralin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitPrimitiveType
Visits a PrimitiveTypeTree node. This implementation callsdefaultAction.- Specified by:
visitPrimitiveTypein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitArrayType
Visits an ArrayTypeTree node. This implementation callsdefaultAction.- Specified by:
visitArrayTypein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitParameterizedType
Visits a ParameterizedTypeTree node. This implementation callsdefaultAction.- Specified by:
visitParameterizedTypein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitUnionType
Visits a UnionTypeTree node. This implementation callsdefaultAction.- Specified by:
visitUnionTypein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitIntersectionType
Visits an IntersectionTypeTree node. This implementation callsdefaultAction.- Specified by:
visitIntersectionTypein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitTypeParameter
Visits a TypeParameterTree node. This implementation callsdefaultAction.- Specified by:
visitTypeParameterin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitWildcard
Visits a WildcardTypeTree node. This implementation callsdefaultAction.- Specified by:
visitWildcardin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitModifiers
Visits a ModifiersTree node. This implementation callsdefaultAction.- Specified by:
visitModifiersin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitAnnotation
Visits an AnnotatedTree node. This implementation callsdefaultAction.- Specified by:
visitAnnotationin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitAnnotatedType
Visits an AnnotatedTypeTree node. This implementation callsdefaultAction.- Specified by:
visitAnnotatedTypein interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitOther
Visits an unknown type of Tree node. This can occur if the language evolves and new kinds of nodes are added to theTreehierarchy. This implementation callsdefaultAction.- Specified by:
visitOtherin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-
visitYield
Visits a YieldTree node. This implementation callsdefaultAction.- Specified by:
visitYieldin interfaceTreeVisitor<R,P>- Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of
defaultAction
-