java.lang.Object
com.sun.source.util.SimpleTreeVisitor<R,P>
- Type Parameters:
- R- the return type of this visitor's methods. Use- Voidfor visitors that do not need to return results.
- P- the type of the additional parameter to this visitor's methods. Use- Voidfor 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 SummaryFields Modifier and Type Field Description protected RDEFAULT_VALUEThe default value, returned by thedefault action.
- 
Constructor SummaryConstructors Modifier Constructor Description protectedSimpleTreeVisitor()Creates a visitor, with a DEFAULT_VALUE ofnull.protectedSimpleTreeVisitor(R defaultValue)Creates a visitor, with a specified DEFAULT_VALUE.
- 
Method SummaryModifier 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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface com.sun.source.tree.TreeVisitorvisitErroneous, visitExports, visitModule, visitOpens, visitProvides, visitRequires, visitUses
- 
Field Details- 
DEFAULT_VALUEThe default value, returned by thedefault action.
 
- 
- 
Constructor Details- 
SimpleTreeVisitorprotected SimpleTreeVisitor()Creates a visitor, with a DEFAULT_VALUE ofnull.
- 
SimpleTreeVisitorCreates a visitor, with a specified DEFAULT_VALUE.- Parameters:
- defaultValue- the default value to be returned by the default action.
 
 
- 
- 
Method Details- 
defaultActionThe default action, used by all visit methods that are not overridden.- Parameters:
- node- the node being visited
- p- the parameter value passed to the visit method
- Returns:
- the result value to be returned from the visit method
 
- 
visitInvokes the appropriate visit method specific to the type of the node.- Parameters:
- node- the node on which to dispatch
- p- a parameter to be passed to the appropriate visit method
- Returns:
- the value returns from the appropriate visit method
 
- 
visitInvokes the appropriate visit method on each of a sequence of nodes.- Parameters:
- nodes- the nodes on which to dispatch
- p- 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.
 
- 
visitCompilationUnitVisits a CompilationUnitTree node. This implementation callsdefaultAction.- Specified by:
- visitCompilationUnitin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitPackageVisits a PackageTree node. This implementation callsdefaultAction.- Specified by:
- visitPackagein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitImportVisits an ImportTree node. This implementation callsdefaultAction.- Specified by:
- visitImportin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitClassVisits a ClassTree node. This implementation callsdefaultAction.- Specified by:
- visitClassin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitMethodVisits a MethodTree node. This implementation callsdefaultAction.- Specified by:
- visitMethodin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitVariableVisits a VariableTree node. This implementation callsdefaultAction.- Specified by:
- visitVariablein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitEmptyStatementVisits an EmptyStatementTree node. This implementation callsdefaultAction.- Specified by:
- visitEmptyStatementin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitBlockVisits a BlockTree node. This implementation callsdefaultAction.- Specified by:
- visitBlockin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitDoWhileLoopVisits a DoWhileTree node. This implementation callsdefaultAction.- Specified by:
- visitDoWhileLoopin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitWhileLoopVisits a WhileLoopTree node. This implementation callsdefaultAction.- Specified by:
- visitWhileLoopin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitForLoopVisits a ForLoopTree node. This implementation callsdefaultAction.- Specified by:
- visitForLoopin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitEnhancedForLoopVisits an EnhancedForLoopTree node. This implementation callsdefaultAction.- Specified by:
- visitEnhancedForLoopin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitLabeledStatementVisits a LabeledStatementTree node. This implementation callsdefaultAction.- Specified by:
- visitLabeledStatementin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitSwitchVisits a SwitchTree node. This implementation callsdefaultAction.- Specified by:
- visitSwitchin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitSwitchExpressionVisits a SwitchExpressionTree node. This implementation callsdefaultAction.- Specified by:
- visitSwitchExpressionin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitCaseVisits a CaseTree node. This implementation callsdefaultAction.- Specified by:
- visitCasein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitSynchronizedVisits a SynchronizedTree node. This implementation callsdefaultAction.- Specified by:
- visitSynchronizedin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitTryVisits a TryTree node. This implementation callsdefaultAction.- Specified by:
- visitTryin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitCatchVisits a CatchTree node. This implementation callsdefaultAction.- Specified by:
- visitCatchin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitConditionalExpressionVisits a ConditionalExpressionTree node. This implementation callsdefaultAction.- Specified by:
- visitConditionalExpressionin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitIfVisits an IfTree node. This implementation callsdefaultAction.- Specified by:
- visitIfin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitExpressionStatementVisits an ExpressionStatementTree node. This implementation callsdefaultAction.- Specified by:
- visitExpressionStatementin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitBreakVisits a BreakTree node. This implementation callsdefaultAction.- Specified by:
- visitBreakin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitContinueVisits a ContinueTree node. This implementation callsdefaultAction.- Specified by:
- visitContinuein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitReturnVisits a ReturnTree node. This implementation callsdefaultAction.- Specified by:
- visitReturnin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitThrowVisits a ThrowTree node. This implementation callsdefaultAction.- Specified by:
- visitThrowin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitAssertVisits an AssertTree node. This implementation callsdefaultAction.- Specified by:
- visitAssertin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitMethodInvocationVisits a MethodInvocationTree node. This implementation callsdefaultAction.- Specified by:
- visitMethodInvocationin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitNewClassVisits a NewClassTree node. This implementation callsdefaultAction.- Specified by:
- visitNewClassin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitNewArrayVisits a NewArrayTree node. This implementation callsdefaultAction.- Specified by:
- visitNewArrayin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitLambdaExpressionVisits a LambdaExpressionTree node. This implementation callsdefaultAction.- Specified by:
- visitLambdaExpressionin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitParenthesizedVisits a ParenthesizedTree node. This implementation callsdefaultAction.- Specified by:
- visitParenthesizedin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitAssignmentVisits an AssignmentTree node. This implementation callsdefaultAction.- Specified by:
- visitAssignmentin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitCompoundAssignmentVisits a CompoundAssignmentTree node. This implementation callsdefaultAction.- Specified by:
- visitCompoundAssignmentin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitUnaryVisits a UnaryTree node. This implementation callsdefaultAction.- Specified by:
- visitUnaryin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitBinaryVisits a BinaryTree node. This implementation callsdefaultAction.- Specified by:
- visitBinaryin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitTypeCastVisits a TypeCastTree node. This implementation callsdefaultAction.- Specified by:
- visitTypeCastin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitInstanceOfVisits an InstanceOfTree node. This implementation callsdefaultAction.- Specified by:
- visitInstanceOfin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitBindingPatternThis 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 interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
- Since:
- 14
 
- 
visitArrayAccessVisits an ArrayAccessTree node. This implementation callsdefaultAction.- Specified by:
- visitArrayAccessin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitMemberSelectVisits a MemberSelectTree node. This implementation callsdefaultAction.- Specified by:
- visitMemberSelectin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitMemberReferenceVisits a MemberReferenceTree node. This implementation callsdefaultAction.- Specified by:
- visitMemberReferencein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitIdentifierVisits an IdentifierTree node. This implementation callsdefaultAction.- Specified by:
- visitIdentifierin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitLiteralVisits a LiteralTree node. This implementation callsdefaultAction.- Specified by:
- visitLiteralin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitPrimitiveTypeVisits a PrimitiveTypeTree node. This implementation callsdefaultAction.- Specified by:
- visitPrimitiveTypein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitArrayTypeVisits an ArrayTypeTree node. This implementation callsdefaultAction.- Specified by:
- visitArrayTypein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitParameterizedTypeVisits a ParameterizedTypeTree node. This implementation callsdefaultAction.- Specified by:
- visitParameterizedTypein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitUnionTypeVisits a UnionTypeTree node. This implementation callsdefaultAction.- Specified by:
- visitUnionTypein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitIntersectionTypeVisits an IntersectionTypeTree node. This implementation callsdefaultAction.- Specified by:
- visitIntersectionTypein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitTypeParameterVisits a TypeParameterTree node. This implementation callsdefaultAction.- Specified by:
- visitTypeParameterin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitWildcardVisits a WildcardTypeTree node. This implementation callsdefaultAction.- Specified by:
- visitWildcardin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitModifiersVisits a ModifiersTree node. This implementation callsdefaultAction.- Specified by:
- visitModifiersin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitAnnotationVisits an AnnotatedTree node. This implementation callsdefaultAction.- Specified by:
- visitAnnotationin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitAnnotatedTypeVisits an AnnotatedTypeTree node. This implementation callsdefaultAction.- Specified by:
- visitAnnotatedTypein interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitOtherVisits 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 interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
- 
visitYieldVisits a YieldTree node. This implementation callsdefaultAction.- Specified by:
- visitYieldin interface- TreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of defaultAction
 
 
-