public abstract class ASTVisitor extends Object
For each different concrete AST node type T there are a pair of methods:
public boolean visit(T node)
- Visits
the given node to perform some arbitrary operation. If true
is returned, the given node's child nodes will be visited next; however,
if false
is returned, the given node's child nodes will
not be visited. The default implementation provided by this class does
nothing and returns true
(with the exception of
ASTVisitor.visit(Javadoc)
).
Subclasses may reimplement this method as needed.public void endVisit(T node)
- Visits
the given node to perform some arbitrary operation. When used in the
conventional way, this method is called after all of the given node's
children have been visited (or immediately, if visit
returned
false
). The default implementation provided by this class does
nothing. Subclasses may reimplement this method as needed.public void preVisit(ASTNode node)
- Visits
the given node to perform some arbitrary operation.
This method is invoked prior to the appropriate type-specific
visit
method.
The default implementation of this method does nothing.
Subclasses may reimplement this method as needed.public void postVisit(ASTNode node)
- Visits
the given node to perform some arbitrary operation.
This method is invoked after the appropriate type-specific
endVisit
method.
The default implementation of this method does nothing.
Subclasses may reimplement this method as needed.For nodes with list-valued properties, the child nodes within the list are visited in order. For nodes with multiple properties, the child nodes are visited in the order that most closely corresponds to the lexical reading order of the source program. For instance, for a type declaration node, the child ordering is: name, superclass, superinterfaces, and body declarations.
While it is possible to modify the tree in the visitor, care is required to
ensure that the consequences are as expected and desirable.
During the course of an ordinary visit starting at a given node, every node
in the subtree is visited exactly twice, first with visit
and
then with endVisit
. During a traversal of a stationary tree,
each node is either behind (after endVisit
), ahead (before
visit
), or in progress (between visit
and
the matching endVisit
). Changes to the "behind" region of the
tree are of no consequence to the visit in progress. Changes to the "ahead"
region will be taken in stride. Changes to the "in progress" portion are
the more interesting cases. With a node, the various properties are arranged
in a linear list, with a cursor that separates the properties that have
been visited from the ones that are still to be visited (the cursor
is between the elements, rather than on an element). The cursor moves from
the head to the tail of this list, advancing to the next position just
before visit
if called for that child. After the child
subtree has been completely visited, the visit moves on the child
immediately after the cursor. Removing a child while it is being visited
does not alter the course of the visit. But any children added at positions
after the cursor are considered in the "ahead" portion and will be visited.
Cases to watch out for:
Note that LineComment
and BlockComment
nodes are
not normally visited in an AST because they are not considered
part of main structure of the AST. Use
CompilationUnit.getCommentList()
to find these additional
comments nodes.
ASTNode.accept(ASTVisitor)
Constructor and Description |
---|
ASTVisitor()
Creates a new AST visitor instance.
|
ASTVisitor(boolean visitDocTags)
Creates a new AST visitor instance.
|
Modifier and Type | Method and Description |
---|---|
void |
endVisit(AnnotationTypeDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(AnnotationTypeMemberDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(AnonymousClassDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(ArrayAccess node)
End of visit the given type-specific AST node.
|
void |
endVisit(ArrayCreation node)
End of visit the given type-specific AST node.
|
void |
endVisit(ArrayInitializer node)
End of visit the given type-specific AST node.
|
void |
endVisit(ArrayType node)
End of visit the given type-specific AST node.
|
void |
endVisit(AssertStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(Assignment node)
End of visit the given type-specific AST node.
|
void |
endVisit(Block node)
End of visit the given type-specific AST node.
|
void |
endVisit(BlockComment node)
End of visit the given type-specific AST node.
|
void |
endVisit(BooleanLiteral node)
End of visit the given type-specific AST node.
|
void |
endVisit(BreakStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(CastExpression node)
End of visit the given type-specific AST node.
|
void |
endVisit(CatchClause node)
End of visit the given type-specific AST node.
|
void |
endVisit(CharacterLiteral node)
End of visit the given type-specific AST node.
|
void |
endVisit(ClassInstanceCreation node)
End of visit the given type-specific AST node.
|
void |
endVisit(CompilationUnit node)
End of visit the given type-specific AST node.
|
void |
endVisit(ConditionalExpression node)
End of visit the given type-specific AST node.
|
void |
endVisit(ConstructorInvocation node)
End of visit the given type-specific AST node.
|
void |
endVisit(ContinueStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(DoStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(EmptyStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(EnhancedForStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(EnumConstantDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(EnumDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(ExpressionStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(FieldAccess node)
End of visit the given type-specific AST node.
|
void |
endVisit(FieldDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(ForStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(IfStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(ImportDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(InfixExpression node)
End of visit the given type-specific AST node.
|
void |
endVisit(Initializer node)
End of visit the given type-specific AST node.
|
void |
endVisit(InstanceofExpression node)
End of visit the given type-specific AST node.
|
void |
endVisit(Javadoc node)
End of visit the given type-specific AST node.
|
void |
endVisit(LabeledStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(LineComment node)
End of visit the given type-specific AST node.
|
void |
endVisit(MarkerAnnotation node)
End of visit the given type-specific AST node.
|
void |
endVisit(MemberRef node)
End of visit the given type-specific AST node.
|
void |
endVisit(MemberValuePair node)
End of visit the given type-specific AST node.
|
void |
endVisit(MethodDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(MethodInvocation node)
End of visit the given type-specific AST node.
|
void |
endVisit(MethodRef node)
End of visit the given type-specific AST node.
|
void |
endVisit(MethodRefParameter node)
End of visit the given type-specific AST node.
|
void |
endVisit(Modifier node)
End of visit the given type-specific AST node.
|
void |
endVisit(NormalAnnotation node)
End of visit the given type-specific AST node.
|
void |
endVisit(NullLiteral node)
End of visit the given type-specific AST node.
|
void |
endVisit(NumberLiteral node)
End of visit the given type-specific AST node.
|
void |
endVisit(PackageDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(ParameterizedType node)
End of visit the given type-specific AST node.
|
void |
endVisit(ParenthesizedExpression node)
End of visit the given type-specific AST node.
|
void |
endVisit(PostfixExpression node)
End of visit the given type-specific AST node.
|
void |
endVisit(PrefixExpression node)
End of visit the given type-specific AST node.
|
void |
endVisit(PrimitiveType node)
End of visit the given type-specific AST node.
|
void |
endVisit(QualifiedName node)
End of visit the given type-specific AST node.
|
void |
endVisit(QualifiedType node)
End of visit the given type-specific AST node.
|
void |
endVisit(ReturnStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(SimpleName node)
End of visit the given type-specific AST node.
|
void |
endVisit(SimpleType node)
End of visit the given type-specific AST node.
|
void |
endVisit(SingleMemberAnnotation node)
End of visit the given type-specific AST node.
|
void |
endVisit(SingleVariableDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(StringLiteral node)
End of visit the given type-specific AST node.
|
void |
endVisit(SuperConstructorInvocation node)
End of visit the given type-specific AST node.
|
void |
endVisit(SuperFieldAccess node)
End of visit the given type-specific AST node.
|
void |
endVisit(SuperMethodInvocation node)
End of visit the given type-specific AST node.
|
void |
endVisit(SwitchCase node)
End of visit the given type-specific AST node.
|
void |
endVisit(SwitchStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(SynchronizedStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(TagElement node)
End of visit the given type-specific AST node.
|
void |
endVisit(TextElement node)
End of visit the given type-specific AST node.
|
void |
endVisit(ThisExpression node)
End of visit the given type-specific AST node.
|
void |
endVisit(ThrowStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(TryStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(TypeDeclaration node)
End of visit the given type-specific AST node.
|
void |
endVisit(TypeDeclarationStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(TypeLiteral node)
End of visit the given type-specific AST node.
|
void |
endVisit(TypeParameter node)
End of visit the given type-specific AST node.
|
void |
endVisit(UnionType node)
End of visit the given type-specific AST node.
|
void |
endVisit(VariableDeclarationExpression node)
End of visit the given type-specific AST node.
|
void |
endVisit(VariableDeclarationFragment node)
End of visit the given type-specific AST node.
|
void |
endVisit(VariableDeclarationStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(WhileStatement node)
End of visit the given type-specific AST node.
|
void |
endVisit(WildcardType node)
End of visit the given type-specific AST node.
|
void |
postVisit(ASTNode node)
Visits the given AST node following the type-specific visit
(after
endVisit ). |
void |
preVisit(ASTNode node)
Visits the given AST node prior to the type-specific visit
(before
visit ). |
boolean |
preVisit2(ASTNode node)
Visits the given AST node prior to the type-specific visit (before
visit ). |
boolean |
visit(AnnotationTypeDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(AnnotationTypeMemberDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(AnonymousClassDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(ArrayAccess node)
Visits the given type-specific AST node.
|
boolean |
visit(ArrayCreation node)
Visits the given type-specific AST node.
|
boolean |
visit(ArrayInitializer node)
Visits the given type-specific AST node.
|
boolean |
visit(ArrayType node)
Visits the given type-specific AST node.
|
boolean |
visit(AssertStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(Assignment node)
Visits the given type-specific AST node.
|
boolean |
visit(Block node)
Visits the given type-specific AST node.
|
boolean |
visit(BlockComment node)
Visits the given type-specific AST node.
|
boolean |
visit(BooleanLiteral node)
Visits the given type-specific AST node.
|
boolean |
visit(BreakStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(CastExpression node)
Visits the given type-specific AST node.
|
boolean |
visit(CatchClause node)
Visits the given type-specific AST node.
|
boolean |
visit(CharacterLiteral node)
Visits the given type-specific AST node.
|
boolean |
visit(ClassInstanceCreation node)
Visits the given type-specific AST node.
|
boolean |
visit(CompilationUnit node)
Visits the given type-specific AST node.
|
boolean |
visit(ConditionalExpression node)
Visits the given type-specific AST node.
|
boolean |
visit(ConstructorInvocation node)
Visits the given type-specific AST node.
|
boolean |
visit(ContinueStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(DoStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(EmptyStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(EnhancedForStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(EnumConstantDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(EnumDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(ExpressionStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(FieldAccess node)
Visits the given type-specific AST node.
|
boolean |
visit(FieldDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(ForStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(IfStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(ImportDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(InfixExpression node)
Visits the given type-specific AST node.
|
boolean |
visit(Initializer node)
Visits the given type-specific AST node.
|
boolean |
visit(InstanceofExpression node)
Visits the given type-specific AST node.
|
boolean |
visit(Javadoc node)
Visits the given AST node.
|
boolean |
visit(LabeledStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(LineComment node)
Visits the given type-specific AST node.
|
boolean |
visit(MarkerAnnotation node)
Visits the given type-specific AST node.
|
boolean |
visit(MemberRef node)
Visits the given type-specific AST node.
|
boolean |
visit(MemberValuePair node)
Visits the given type-specific AST node.
|
boolean |
visit(MethodDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(MethodInvocation node)
Visits the given type-specific AST node.
|
boolean |
visit(MethodRef node)
Visits the given type-specific AST node.
|
boolean |
visit(MethodRefParameter node)
Visits the given type-specific AST node.
|
boolean |
visit(Modifier node)
Visits the given type-specific AST node.
|
boolean |
visit(NormalAnnotation node)
Visits the given type-specific AST node.
|
boolean |
visit(NullLiteral node)
Visits the given type-specific AST node.
|
boolean |
visit(NumberLiteral node)
Visits the given type-specific AST node.
|
boolean |
visit(PackageDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(ParameterizedType node)
Visits the given type-specific AST node.
|
boolean |
visit(ParenthesizedExpression node)
Visits the given type-specific AST node.
|
boolean |
visit(PostfixExpression node)
Visits the given type-specific AST node.
|
boolean |
visit(PrefixExpression node)
Visits the given type-specific AST node.
|
boolean |
visit(PrimitiveType node)
Visits the given type-specific AST node.
|
boolean |
visit(QualifiedName node)
Visits the given type-specific AST node.
|
boolean |
visit(QualifiedType node)
Visits the given type-specific AST node.
|
boolean |
visit(ReturnStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(SimpleName node)
Visits the given type-specific AST node.
|
boolean |
visit(SimpleType node)
Visits the given type-specific AST node.
|
boolean |
visit(SingleMemberAnnotation node)
Visits the given type-specific AST node.
|
boolean |
visit(SingleVariableDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(StringLiteral node)
Visits the given type-specific AST node.
|
boolean |
visit(SuperConstructorInvocation node)
Visits the given type-specific AST node.
|
boolean |
visit(SuperFieldAccess node)
Visits the given type-specific AST node.
|
boolean |
visit(SuperMethodInvocation node)
Visits the given type-specific AST node.
|
boolean |
visit(SwitchCase node)
Visits the given type-specific AST node.
|
boolean |
visit(SwitchStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(SynchronizedStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(TagElement node)
Visits the given type-specific AST node.
|
boolean |
visit(TextElement node)
Visits the given type-specific AST node.
|
boolean |
visit(ThisExpression node)
Visits the given type-specific AST node.
|
boolean |
visit(ThrowStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(TryStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(TypeDeclaration node)
Visits the given type-specific AST node.
|
boolean |
visit(TypeDeclarationStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(TypeLiteral node)
Visits the given type-specific AST node.
|
boolean |
visit(TypeParameter node)
Visits the given type-specific AST node.
|
boolean |
visit(UnionType node)
Visits the given type-specific AST node.
|
boolean |
visit(VariableDeclarationExpression node)
Visits the given type-specific AST node.
|
boolean |
visit(VariableDeclarationFragment node)
Visits the given type-specific AST node.
|
boolean |
visit(VariableDeclarationStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(WhileStatement node)
Visits the given type-specific AST node.
|
boolean |
visit(WildcardType node)
Visits the given type-specific AST node.
|
public ASTVisitor()
For backwards compatibility, the visitor does not visit tag
elements below doc comments by default. Use
ASTVisitor(true)
for an visitor that includes doc comments by default.
public ASTVisitor(boolean visitDocTags)
visitDocTags
- true
if doc comment tags are
to be visited by default, and false
otherwiseJavadoc.tags()
,
visit(Javadoc)
public void preVisit(ASTNode node)
visit
).
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpreVisit2(ASTNode)
public boolean preVisit2(ASTNode node)
visit
).
The default implementation calls preVisit(ASTNode)
and then
returns true. Subclasses may reimplement.
node
- the node to visittrue
if visit(node)
should be called,
and false
otherwise.preVisit(ASTNode)
public void postVisit(ASTNode node)
endVisit
).
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic boolean visit(AnnotationTypeDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(AnnotationTypeMemberDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(AnonymousClassDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ArrayAccess node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ArrayCreation node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ArrayInitializer node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ArrayType node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(AssertStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(Assignment node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(Block node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(BlockComment node)
The default implementation does nothing and return true. Subclasses may reimplement.
Note: LineComment
and BlockComment
nodes are
not considered part of main structure of the AST. This method will
only be called if a client goes out of their way to visit this
kind of node explicitly.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(BooleanLiteral node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(BreakStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(CastExpression node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(CatchClause node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(CharacterLiteral node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ClassInstanceCreation node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(CompilationUnit node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ConditionalExpression node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ConstructorInvocation node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ContinueStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(DoStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(EmptyStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(EnhancedForStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(EnumConstantDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(EnumDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ExpressionStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(FieldAccess node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(FieldDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ForStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(IfStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ImportDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(InfixExpression node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(InstanceofExpression node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(Initializer node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(Javadoc node)
Unlike other node types, the boolean returned by the default
implementation is controlled by a constructor-supplied
parameter ASTVisitor(boolean)
which is false
by default.
Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedASTVisitor()
,
ASTVisitor(boolean)
public boolean visit(LabeledStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(LineComment node)
The default implementation does nothing and return true. Subclasses may reimplement.
Note: LineComment
and BlockComment
nodes are
not considered part of main structure of the AST. This method will
only be called if a client goes out of their way to visit this
kind of node explicitly.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(MarkerAnnotation node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(MemberRef node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(MemberValuePair node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(MethodRef node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(MethodRefParameter node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(MethodDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(MethodInvocation node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(Modifier node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(NormalAnnotation node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(NullLiteral node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(NumberLiteral node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(PackageDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ParameterizedType node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ParenthesizedExpression node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(PostfixExpression node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(PrefixExpression node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(PrimitiveType node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(QualifiedName node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(QualifiedType node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ReturnStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(SimpleName node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(SimpleType node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(SingleMemberAnnotation node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(SingleVariableDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(StringLiteral node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(SuperConstructorInvocation node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(SuperFieldAccess node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(SuperMethodInvocation node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(SwitchCase node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(SwitchStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(SynchronizedStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(TagElement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(TextElement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ThisExpression node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(ThrowStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(TryStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(TypeDeclaration node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(TypeDeclarationStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(TypeLiteral node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(TypeParameter node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(UnionType node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(VariableDeclarationExpression node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(VariableDeclarationStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(VariableDeclarationFragment node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(WhileStatement node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic boolean visit(WildcardType node)
The default implementation does nothing and return true. Subclasses may reimplement.
node
- the node to visittrue
if the children of this node should be
visited, and false
if the children of this node should
be skippedpublic void endVisit(AnnotationTypeDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(AnnotationTypeMemberDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(AnonymousClassDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ArrayAccess node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ArrayCreation node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ArrayInitializer node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ArrayType node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(AssertStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(Assignment node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(Block node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(BlockComment node)
The default implementation does nothing. Subclasses may reimplement.
Note: LineComment
and BlockComment
nodes are
not considered part of main structure of the AST. This method will
only be called if a client goes out of their way to visit this
kind of node explicitly.
node
- the node to visitpublic void endVisit(BooleanLiteral node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(BreakStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(CastExpression node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(CatchClause node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(CharacterLiteral node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ClassInstanceCreation node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(CompilationUnit node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ConditionalExpression node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ConstructorInvocation node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ContinueStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(DoStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(EmptyStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(EnhancedForStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(EnumConstantDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(EnumDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ExpressionStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(FieldAccess node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(FieldDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ForStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(IfStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ImportDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(InfixExpression node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(InstanceofExpression node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(Initializer node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(Javadoc node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(LabeledStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(LineComment node)
The default implementation does nothing. Subclasses may reimplement.
Note: LineComment
and BlockComment
nodes are
not considered part of main structure of the AST. This method will
only be called if a client goes out of their way to visit this
kind of node explicitly.
node
- the node to visitpublic void endVisit(MarkerAnnotation node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(MemberRef node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(MemberValuePair node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(MethodRef node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(MethodRefParameter node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(MethodDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(MethodInvocation node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(Modifier node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(NormalAnnotation node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(NullLiteral node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(NumberLiteral node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(PackageDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ParameterizedType node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ParenthesizedExpression node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(PostfixExpression node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(PrefixExpression node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(PrimitiveType node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(QualifiedName node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(QualifiedType node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ReturnStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(SimpleName node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(SimpleType node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(SingleMemberAnnotation node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(SingleVariableDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(StringLiteral node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(SuperConstructorInvocation node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(SuperFieldAccess node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(SuperMethodInvocation node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(SwitchCase node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(SwitchStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(SynchronizedStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(TagElement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(TextElement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ThisExpression node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(ThrowStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(TryStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(TypeDeclaration node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(TypeDeclarationStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(TypeLiteral node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(TypeParameter node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(UnionType node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(VariableDeclarationExpression node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(VariableDeclarationStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(VariableDeclarationFragment node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(WhileStatement node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visitpublic void endVisit(WildcardType node)
The default implementation does nothing. Subclasses may reimplement.
node
- the node to visit
Copyright (c) 2000, 2013 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.