Package net.sourceforge.pmd.lang.ast
Class AstVisitorBase<P,R>
java.lang.Object
net.sourceforge.pmd.lang.ast.AstVisitorBase<P,R>
- All Implemented Interfaces:
AstVisitor<P,R>
Base implementation of
AstVisitor, that performs a top-down
(preorder) visit and may accumulate a result.
Note that if you care about the result (<R>), then you need
to override visitChildren to implement
the logic that combines values from children, if any.
-
Constructor Details
-
AstVisitorBase
public AstVisitorBase()
-
-
Method Details
-
visitChildren
Visit the children. By default the data parameter is passed unchanged to all descendants, and null is returned. Override this method to customize this behavior.- Parameters:
node- Node whose children should be visiteddata- Parameter of the visit- Returns:
- Some value for the children
-
visitNode
Description copied from interface:AstVisitorVisit a node. This method is dispatched statically, you should useNode.acceptVisitor(AstVisitor, Object)if you want to call the most specific method instead.- Specified by:
visitNodein interfaceAstVisitor<P,R> - Parameters:
node- Node to visitparam- Parameter- Returns:
- Some result
-