Class ASTMethodDeclaration
- java.lang.Object
-
- net.sourceforge.pmd.lang.ast.AbstractNode
-
- net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode<JavaNode>
-
- All Implemented Interfaces:
net.sourceforge.pmd.lang.ast.Node,net.sourceforge.pmd.lang.ast.QualifiableNode,net.sourceforge.pmd.lang.ast.SignedNode<ASTMethodOrConstructorDeclaration>,net.sourceforge.pmd.lang.dfa.DFAGraphMethod,AccessNode,Annotatable,ASTMethodOrConstructorDeclaration,JavaNode,JavaQualifiableNode,MethodLikeNode,net.sourceforge.pmd.lang.symboltable.ScopedNode
public class ASTMethodDeclaration extends AbstractMethodOrConstructorDeclaration implements net.sourceforge.pmd.lang.dfa.DFAGraphMethod
Method declaration node.MethodDeclaration := [ TypeParameters() ] (TypeAnnotation())* ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" )
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sourceforge.pmd.lang.java.ast.MethodLikeNode
MethodLikeNode.MethodLikeKind
-
-
Field Summary
-
Fields inherited from class net.sourceforge.pmd.lang.java.ast.AbstractJavaNode
parser
-
-
Constructor Summary
Constructors Constructor Description ASTMethodDeclaration(int id)Deprecated.ASTMethodDeclaration(JavaParser p, int id)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ASTAnnotationgetAnnotation(String annotQualifiedName)Get specific annotaion on this node.intgetArity()Returns the number of formal parameters expected by this method (excluding any receiver parameter).ASTBlockgetBlock()Deprecated.UsegetBody()ASTBlockgetBody()Returns the block defined by this method, or null if the method is abstract.List<ASTAnnotation>getDeclaredAnnotations()Get all annotations present on this node.ASTFormalParametersgetFormalParameters()MethodLikeNode.MethodLikeKindgetKind()Returns a token indicating whether this node is a lambda expression or a method or constructor declaration.ASTMethodDeclaratorgetMethodDeclarator()Deprecated.Method declarator nodes will be removed with 7.0.0StringgetMethodName()Deprecated.UsegetName()StringgetName()Returns the simple name of the method.ASTResultTypegetResultType()Returns the result type node of the method.ASTNameListgetThrows()Returns the exception names listed in thethrowsclause of this method declaration, or null if there are none.booleanisAbstract()Returns true if this method is abstract, so doesn't declare a body.booleanisAnnotationPresent(String annotQualifiedName)Checks whether the annotation is present on this node.booleanisAnyAnnotationPresent(Collection<String> annotQualifiedNames)Checks whether any annotation is present on this node.booleanisInterfaceMember()Returns true if this method declaration is a member of an interface type.booleanisPublic()Returns true if this method has public visibility.booleanisSyntacticallyAbstract()Returns true if this method is explicitly modified by theabstractmodifier.booleanisSyntacticallyPublic()Returns true if this method is explicitly modified by thepublicmodifier.booleanisVoid()Returns true if the result type of this method isvoid.ObjectjjtAccept(JavaParserVisitor visitor, Object data)Calls back the visitor's visit method corresponding to the runtime type of this Node.-
Methods inherited from class net.sourceforge.pmd.lang.java.ast.AbstractMethodOrConstructorDeclaration
getSignature
-
Methods inherited from class net.sourceforge.pmd.lang.java.ast.AbstractMethodLikeNode
getQualifiedName, setQualifiedName
-
Methods inherited from class net.sourceforge.pmd.lang.java.ast.AbstractJavaAccessNode
getModifiers, isDefault, isFinal, isNative, isPackagePrivate, isPrivate, isProtected, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setAbstract, setDefault, setFinal, setModifiers, setNative, setPrivate, setProtected, setPublic, setStatic, setStrictfp, setSynchronized, setTransient, setVolatile
-
Methods inherited from class net.sourceforge.pmd.lang.java.ast.AbstractJavaNode
childrenAccept, comment, comment, getScope, getXPathNodeName, jjtClose, jjtOpen, setScope
-
Methods inherited from class net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode
children, getChild, getParent
-
Methods inherited from class net.sourceforge.pmd.lang.ast.AbstractNode
appendElement, findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getIndexInParent, getNthParent, getNumChildren, getParentsOfType, getUserData, getUserMap, getXPathAttributesIterator, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.AccessNode
getModifiers, isDefault, isFinal, isNative, isPackagePrivate, isPrivate, isProtected, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setAbstract, setDefault, setFinal, setModifiers, setNative, setPrivate, setProtected, setPublic, setStatic, setStrictfp, setSynchronized, setTransient, setVolatile
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaNode
children, childrenAccept, getChild, getParent, setScope
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.MethodLikeNode
getQualifiedName
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.Node
findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getIndexInParent, getNthParent, getNumChildren, getParentsOfType, getUserData, getUserMap, getXPathAttributesIterator, getXPathNodeName, hasDescendantMatchingXPath, hasDescendantOfType, hasImageEqualTo, isFindBoundary, jjtAddChild, jjtClose, jjtGetChild, jjtGetChildIndex, jjtGetId, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetChildIndex, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData
-
-
-
-
Constructor Detail
-
ASTMethodDeclaration
@InternalApi @Deprecated public ASTMethodDeclaration(int id)
Deprecated.
-
ASTMethodDeclaration
@InternalApi @Deprecated public ASTMethodDeclaration(JavaParser p, int id)
Deprecated.
-
-
Method Detail
-
jjtAccept
public Object jjtAccept(JavaParserVisitor visitor, Object data)
Description copied from interface:JavaNodeCalls back the visitor's visit method corresponding to the runtime type of this Node.- Specified by:
jjtAcceptin interfaceJavaNode- Overrides:
jjtAcceptin classAbstractJavaNode- Parameters:
visitor- Visitor to dispatchdata- Visit data
-
getMethodName
@Deprecated public String getMethodName()
Deprecated.UsegetName()Returns the simple name of the method.
-
getName
public String getName()
Returns the simple name of the method.- Specified by:
getNamein interfacenet.sourceforge.pmd.lang.dfa.DFAGraphMethod
-
isSyntacticallyPublic
public boolean isSyntacticallyPublic()
Returns true if this method is explicitly modified by thepublicmodifier.
-
isSyntacticallyAbstract
public boolean isSyntacticallyAbstract()
Returns true if this method is explicitly modified by theabstractmodifier.
-
isPublic
public boolean isPublic()
Returns true if this method has public visibility. Non-private interface members are implicitly public, whether they declare thepublicmodifier or not.- Specified by:
isPublicin interfaceAccessNode- Overrides:
isPublicin classAbstractJavaAccessNode
-
isAbstract
public boolean isAbstract()
Returns true if this method is abstract, so doesn't declare a body. Interface members are implicitly abstract, whether they declare theabstractmodifier or not. Default interface methods are not abstract though, consistently with the standard reflection API.- Specified by:
isAbstractin interfaceAccessNode- Overrides:
isAbstractin classAbstractJavaAccessNode
-
isInterfaceMember
public boolean isInterfaceMember()
Returns true if this method declaration is a member of an interface type.
-
isVoid
public boolean isVoid()
Returns true if the result type of this method isvoid.
-
getResultType
public ASTResultType getResultType()
Returns the result type node of the method.
-
getBlock
@Deprecated public ASTBlock getBlock()
Deprecated.UsegetBody()Returns the block defined by this method, or null if the method is abstract.
-
getBody
public ASTBlock getBody()
Returns the block defined by this method, or null if the method is abstract.
-
getArity
public int getArity()
Returns the number of formal parameters expected by this method (excluding any receiver parameter). A varargs parameter counts as one.
-
getThrows
public ASTNameList getThrows()
Returns the exception names listed in thethrowsclause of this method declaration, or null if there are none.
-
getKind
public MethodLikeNode.MethodLikeKind getKind()
Description copied from interface:MethodLikeNodeReturns a token indicating whether this node is a lambda expression or a method or constructor declaration. Can be used to downcast safely to a subinterface or an implementing class.- Specified by:
getKindin interfaceMethodLikeNode- Returns:
- The kind of method-like
-
getFormalParameters
public ASTFormalParameters getFormalParameters()
-
getMethodDeclarator
@Deprecated public ASTMethodDeclarator getMethodDeclarator()
Deprecated.Method declarator nodes will be removed with 7.0.0Returns the method declarator. Never null.
-
getDeclaredAnnotations
public List<ASTAnnotation> getDeclaredAnnotations()
Description copied from interface:AnnotatableGet all annotations present on this node.- Specified by:
getDeclaredAnnotationsin interfaceAnnotatable- Returns:
- all annotations present on this node.
-
getAnnotation
public ASTAnnotation getAnnotation(String annotQualifiedName)
Description copied from interface:AnnotatableGet specific annotaion on this node.- Specified by:
getAnnotationin interfaceAnnotatable- Parameters:
annotQualifiedName- qulified name of the annotation.- Returns:
ASTAnnotaionnode if the annotation is present on this node, elsenull
-
isAnnotationPresent
public boolean isAnnotationPresent(String annotQualifiedName)
Description copied from interface:AnnotatableChecks whether the annotation is present on this node.- Specified by:
isAnnotationPresentin interfaceAnnotatable- Parameters:
annotQualifiedName- qulified name of the annotation.- Returns:
trueif the annotation is present on this node, elsefalse
-
isAnyAnnotationPresent
public boolean isAnyAnnotationPresent(Collection<String> annotQualifiedNames)
Description copied from interface:AnnotatableChecks whether any annotation is present on this node.- Specified by:
isAnyAnnotationPresentin interfaceAnnotatable- Parameters:
annotQualifiedNames- collection that cotains qulified name of annotations.- Returns:
trueif any annotation is present on this node, elsefalse
-
-