Class JavaVisitorBase<P,R>
- java.lang.Object
-
- net.sourceforge.pmd.lang.ast.AstVisitorBase<P,R>
-
- net.sourceforge.pmd.lang.java.ast.JavaVisitorBase<P,R>
-
- All Implemented Interfaces:
AstVisitor<P,R>
,JavaVisitor<P,R>
- Direct Known Subclasses:
JavaParserVisitorAdapter
,LazyTypeResolver
public class JavaVisitorBase<P,R> extends AstVisitorBase<P,R> implements JavaVisitor<P,R>
Base implementation ofJavaVisitor
. This adds delegation logic which the interface doesn't have.Contrary to the old visitor, which used Object as both parameter and return type, this visitor uses separate type parameters for those. This means you can't just return the parameter, unless your visitor has equal parameter and return type. This type signature subsumes many possible signatures. The old one is
<Object, Object>
, still implemented byJavaParserVisitor
for backwards compatibility. If you don't want to return a value, or don't want a parameter, useVoid
.Since 7.0.0 we use default methods on the interface, which removes code duplication. However it's still recommended to extend a base class, for forward compatibility.
-
-
Constructor Summary
Constructors Constructor Description JavaVisitorBase()
-
Method Summary
-
Methods inherited from class net.sourceforge.pmd.lang.ast.AstVisitorBase
visitChildren, visitNode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.AstVisitor
cannotVisit, visitNode
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitJavaNode
-
-
-
-
Method Detail
-
visitMethodOrCtor
public R visitMethodOrCtor(ASTMethodOrConstructorDeclaration node, P data)
-
visit
public R visit(ASTMethodDeclaration node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTConstructorDeclaration node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visitTypeDecl
public R visitTypeDecl(ASTAnyTypeDeclaration node, P data)
-
visit
public R visit(ASTClassOrInterfaceDeclaration node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTAnonymousClassDeclaration node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTRecordDeclaration node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTEnumDeclaration node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTAnnotationTypeDeclaration node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTPrimitiveType node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visitReferenceType
public R visitReferenceType(ASTReferenceType node, P data)
-
visit
public R visit(ASTArrayType node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTIntersectionType node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTWildcardType node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTUnionType node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTClassOrInterfaceType node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visitExpression
public R visitExpression(ASTExpression node, P data)
-
visit
public R visit(ASTLambdaExpression node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTAssignmentExpression node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTConditionalExpression node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTInfixExpression node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTUnaryExpression node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTCastExpression node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTSwitchExpression node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visitPrimaryExpr
public R visitPrimaryExpr(ASTPrimaryExpression node, P data)
-
visit
public R visit(ASTMethodCall node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTConstructorCall node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTArrayAllocation node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTArrayAccess node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visitNamedExpr
public R visitNamedExpr(ASTAssignableExpr.ASTNamedReferenceExpr node, P data)
-
visit
public R visit(ASTVariableAccess node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTFieldAccess node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTMethodReference node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTThisExpression node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTSuperExpression node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTClassLiteral node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visitLiteral
public R visitLiteral(ASTLiteral node, P data)
-
visit
public R visit(ASTBooleanLiteral node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTNullLiteral node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTNumericLiteral node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTStringLiteral node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTCharLiteral node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visitStatement
public R visitStatement(ASTStatement node, P data)
-
visit
public R visit(ASTAssertStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTBreakStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTContinueStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTDoStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTEmptyStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTExplicitConstructorInvocation node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTExpressionStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTForeachStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTForStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTIfStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTLabeledStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTLocalClassStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTLocalVariableDeclaration node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTReturnStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTStatementExpressionList node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTSwitchStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTSynchronizedStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTThrowStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTTryStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTWhileStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
visit
public R visit(ASTYieldStatement node, P data)
- Specified by:
visit
in interfaceJavaVisitor<P,R>
-
-