Class ASTMethodDeclaration
- java.lang.Object
-
- net.sourceforge.pmd.lang.ast.AbstractNode
-
- 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)
ASTMethodDeclaration(JavaParser p, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ASTAnnotation
getAnnotation(java.lang.String annotQualifiedName)
Get specific annotaion on this node.ASTBlock
getBlock()
Returns the block defined by this method, or null if the method is abstract.java.util.List<ASTAnnotation>
getDeclaredAnnotations()
Get all annotations present on this node.ASTFormalParameters
getFormalParameters()
MethodLikeNode.MethodLikeKind
getKind()
Returns a token indicating whether this node is a lambda expression or a method or constructor declaration.ASTMethodDeclarator
getMethodDeclarator()
Returns the method declarator.java.lang.String
getMethodName()
Returns the simple name of the method.java.lang.String
getName()
ASTResultType
getResultType()
Returns the result type node of the method.ASTNameList
getThrows()
Returns the exception names listed in thethrows
clause of this method declaration, or null if there are none.boolean
isAbstract()
Returns true if this method is abstract, so doesn't declare a body.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
isInterfaceMember()
Returns true if this method declaration is a member of an interface type.boolean
isPublic()
Returns true if this method has public visibility.boolean
isSyntacticallyAbstract()
Returns true if this method is explicitly modified by theabstract
modifier.boolean
isSyntacticallyPublic()
Returns true if this method is explicitly modified by thepublic
modifier.boolean
isVoid()
Returns true if the result type of this method isvoid
.java.lang.Object
jjtAccept(JavaParserVisitor visitor, java.lang.Object data)
Accept the visitor.-
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.java.ast.AbstractMethodLikeNode
getQualifiedName, setQualifiedName
-
Methods inherited from class net.sourceforge.pmd.lang.java.ast.AbstractMethodOrConstructorDeclaration
getSignature
-
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, getNthParent, getParentsOfType, getUserData, 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 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
childrenAccept, getScope, 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, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getNthParent, getParentsOfType, getUserData, getXPathAttributesIterator, getXPathNodeName, hasDescendantMatchingXPath, hasDescendantOfType, hasImageEqualTo, isFindBoundary, jjtAddChild, jjtClose, jjtGetChild, jjtGetChildIndex, jjtGetId, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetChildIndex, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData
-
-
-
-
Constructor Detail
-
ASTMethodDeclaration
public ASTMethodDeclaration(int id)
-
ASTMethodDeclaration
public ASTMethodDeclaration(JavaParser p, int id)
-
-
Method Detail
-
jjtAccept
public java.lang.Object jjtAccept(JavaParserVisitor visitor, java.lang.Object data)
Description copied from class:AbstractJavaNode
Accept the visitor. *- Specified by:
jjtAccept
in interfaceJavaNode
- Overrides:
jjtAccept
in classAbstractJavaNode
-
getMethodName
public java.lang.String getMethodName()
Returns the simple name of the method.
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfacenet.sourceforge.pmd.lang.dfa.DFAGraphMethod
-
isSyntacticallyPublic
public boolean isSyntacticallyPublic()
Returns true if this method is explicitly modified by thepublic
modifier.
-
isSyntacticallyAbstract
public boolean isSyntacticallyAbstract()
Returns true if this method is explicitly modified by theabstract
modifier.
-
isPublic
public boolean isPublic()
Returns true if this method has public visibility. Non-private interface members are implicitly public, whether they declare thepublic
modifier or not.- Specified by:
isPublic
in interfaceAccessNode
- Overrides:
isPublic
in 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 theabstract
modifier or not.- Specified by:
isAbstract
in interfaceAccessNode
- Overrides:
isAbstract
in 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
public ASTBlock getBlock()
Returns the block defined by this method, or null if the method is abstract.
-
getThrows
public ASTNameList getThrows()
Returns the exception names listed in thethrows
clause of this method declaration, or null if there are none.
-
getKind
public MethodLikeNode.MethodLikeKind getKind()
Description copied from interface:MethodLikeNode
Returns 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:
getKind
in interfaceMethodLikeNode
- Returns:
- The kind of method-like
-
getFormalParameters
public ASTFormalParameters getFormalParameters()
-
getMethodDeclarator
public ASTMethodDeclarator getMethodDeclarator()
Returns the method declarator. Never null.
-
getDeclaredAnnotations
public java.util.List<ASTAnnotation> getDeclaredAnnotations()
Description copied from interface:Annotatable
Get all annotations present on this node.- Specified by:
getDeclaredAnnotations
in interfaceAnnotatable
- Returns:
- all annotations present on this node.
-
getAnnotation
public ASTAnnotation getAnnotation(java.lang.String annotQualifiedName)
Description copied from interface:Annotatable
Get specific annotaion on this node.- Specified by:
getAnnotation
in interfaceAnnotatable
- Parameters:
annotQualifiedName
- qulified name of the annotation.- Returns:
ASTAnnotaion
node if the annotation is present on this node, elsenull
-
isAnnotationPresent
public boolean isAnnotationPresent(java.lang.String annotQualifiedName)
Description copied from interface:Annotatable
Checks whether the annotation is present on this node.- Specified by:
isAnnotationPresent
in interfaceAnnotatable
- Parameters:
annotQualifiedName
- qulified name of the annotation.- Returns:
true
if the annotation is present on this node, elsefalse
-
isAnyAnnotationPresent
public boolean isAnyAnnotationPresent(java.util.Collection<java.lang.String> annotQualifiedNames)
Description copied from interface:Annotatable
Checks whether any annotation is present on this node.- Specified by:
isAnyAnnotationPresent
in interfaceAnnotatable
- Parameters:
annotQualifiedNames
- collection that cotains qulified name of annotations.- Returns:
true
if any annotation is present on this node, elsefalse
-
-