net.sourceforge.pmd.lang.ast.Node
, AccessNode
, Annotatable
, CanSuppressWarnings
, Dimensionable
, JavaNode
, TypeNode
, net.sourceforge.pmd.lang.symboltable.ScopedNode
ASTResource
public class ASTFormalParameter extends AbstractJavaAccessTypeNode implements Dimensionable, CanSuppressWarnings
ASTFormalParameters
production of ASTMethodDeclarator
to represent a
method's formal parameter. Also used in the ASTCatchStatement
production to represent the declared exception variable.
( "final" | Annotation )* Type ( "|" Type )* [ "..." ] VariableDeclaratorId
typeDefinition
parser
Constructor | Description |
---|---|
ASTFormalParameter(int id) |
|
ASTFormalParameter(JavaParser p,
int id) |
Modifier and Type | Method | Description |
---|---|---|
ASTAnnotation |
getAnnotation(java.lang.String annotQualifiedName) |
Get specific annotaion on this node.
|
int |
getArrayDepth() |
|
protected ASTVariableDeclaratorId |
getDecl() |
Deprecated.
|
java.util.List<ASTAnnotation> |
getDeclaredAnnotations() |
Get all annotations present on this node.
|
java.lang.Class<?> |
getType() |
Returns the type of this formal parameter.
|
JavaTypeDefinition |
getTypeDefinition() |
Get the TypeDefinition associated with this node.
|
ASTType |
getTypeNode() |
Returns the type node of this formal parameter.
|
ASTVariableDeclaratorId |
getVariableDeclaratorId() |
Returns the declarator ID of this formal parameter.
|
boolean |
hasSuppressWarningsAnnotationFor(net.sourceforge.pmd.Rule rule) |
|
boolean |
isAnnotationPresent(java.lang.String annotQualifiedName) |
Checks whether the annotation is present on this node.
|
boolean |
isAnyAnnotationPresent(java.util.Collection<java.lang.String> annotQualifiedNames) |
Checks whether any annotation is present on this node.
|
boolean |
isArray() |
Returns true if this formal parameter is of an array type.
|
boolean |
isExplicitReceiverParameter() |
Returns true if this node is the explicit receiver parameter,
e.g.
|
boolean |
isVarargs() |
Returns true if this node is a varargs parameter.
|
java.lang.Object |
jjtAccept(JavaParserVisitor visitor,
java.lang.Object data) |
Accept the visitor.
|
void |
setType(java.lang.Class<?> type) |
Noop, the type of this node is defined by the type
of the declarator id.
|
void |
setTypeDefinition(JavaTypeDefinition type) |
Noop, the type of this node is defined by the type
of the declarator id.
|
void |
setVarargs() |
Deprecated.
Will be made private in 7.0.0
|
getModifiers, isAbstract, isDefault, isFinal, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setAbstract, setDefault, setFinal, setModifiers, setNative, setPrivate, setProtected, setPublic, setStatic, setStrictfp, setSynchronized, setTransient, setVolatile
childrenAccept, comment, comment, getScope, getXPathNodeName, jjtClose, jjtOpen, setScope
appendElement, findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getNthParent, getParentsOfType, getUserData, hasDecendantOfAnyType, hasDescendantMatchingXPath, hasDescendantOfAnyType, hasDescendantOfType, hasImageEqualTo, isFindBoundary, isSingleLine, jjtAddChild, jjtGetChild, jjtGetChildIndex, jjtGetFirstToken, jjtGetId, jjtGetLastToken, jjtGetNumChildren, jjtGetParent, jjtSetChildIndex, jjtSetFirstToken, jjtSetLastToken, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData, testingOnlySetBeginColumn, testingOnlySetBeginLine, testingOnlySetEndColumn, testingOnlySetEndLine, toString
childrenAccept, getScope, setScope
findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getNthParent, getParentsOfType, getUserData, getXPathNodeName, hasDescendantMatchingXPath, hasDescendantOfType, hasImageEqualTo, isFindBoundary, jjtAddChild, jjtClose, jjtGetChild, jjtGetChildIndex, jjtGetId, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetChildIndex, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData
public ASTFormalParameter(int id)
public ASTFormalParameter(JavaParser p, int id)
@Deprecated public void setVarargs()
public boolean isVarargs()
public boolean isExplicitReceiverParameter()
class Foo { abstract void foo(@Bar Foo this); }
public java.lang.Object jjtAccept(JavaParserVisitor visitor, java.lang.Object data)
AbstractJavaNode
jjtAccept
in interface JavaNode
jjtAccept
in class AbstractJavaNode
public ASTVariableDeclaratorId getVariableDeclaratorId()
public boolean hasSuppressWarningsAnnotationFor(net.sourceforge.pmd.Rule rule)
hasSuppressWarningsAnnotationFor
in interface CanSuppressWarnings
public boolean isArray()
isArray
in interface Dimensionable
public int getArrayDepth()
getArrayDepth
in interface Dimensionable
public ASTType getTypeNode()
ASTVariableDeclaratorId.getType()
.
In particular, the type of the returned node doesn't take into account whether this formal parameter is varargs or not.
@Deprecated protected ASTVariableDeclaratorId getDecl()
public java.lang.Class<?> getType()
getType
in interface TypeNode
getType
in class AbstractJavaAccessTypeNode
null
.public JavaTypeDefinition getTypeDefinition()
TypeNode
getType()
.getTypeDefinition
in interface TypeNode
getTypeDefinition
in class AbstractJavaAccessTypeNode
null
public void setTypeDefinition(JavaTypeDefinition type)
setTypeDefinition
in interface TypeNode
setTypeDefinition
in class AbstractJavaAccessTypeNode
type
- A TypeDefinition objectpublic void setType(java.lang.Class<?> type)
setType
in interface TypeNode
setType
in class AbstractJavaAccessTypeNode
type
- A Java Classpublic java.util.List<ASTAnnotation> getDeclaredAnnotations()
Annotatable
getDeclaredAnnotations
in interface Annotatable
public ASTAnnotation getAnnotation(java.lang.String annotQualifiedName)
Annotatable
getAnnotation
in interface Annotatable
annotQualifiedName
- qulified name of the annotation.ASTAnnotaion
node if the annotation is present on this node, else null
public boolean isAnnotationPresent(java.lang.String annotQualifiedName)
Annotatable
isAnnotationPresent
in interface Annotatable
annotQualifiedName
- qulified name of the annotation.true
if the annotation is present on this node, else false
public boolean isAnyAnnotationPresent(java.util.Collection<java.lang.String> annotQualifiedNames)
Annotatable
isAnyAnnotationPresent
in interface Annotatable
annotQualifiedNames
- collection that cotains qulified name of annotations.true
if any annotation is present on this node, else false
Copyright © 2002–2018 PMD. All rights reserved.