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 ASTAnnotationgetAnnotation(java.lang.String annotQualifiedName)Get specific annotaion on this node.ASTBlockgetBlock()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.ASTFormalParametersgetFormalParameters()MethodLikeNode.MethodLikeKindgetKind()Returns a token indicating whether this node is a lambda expression or a method or constructor declaration.ASTMethodDeclaratorgetMethodDeclarator()Returns the method declarator.java.lang.StringgetMethodName()Returns the simple name of the method.java.lang.StringgetName()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(java.lang.String annotQualifiedName)Checks whether the annotation is present on this node.booleanisAnyAnnotationPresent(java.util.Collection<java.lang.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.java.lang.ObjectjjtAccept(JavaParserVisitor visitor, java.lang.Object data)Accept the visitor-
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.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 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
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:AbstractJavaNodeAccept the visitor. *- Specified by:
jjtAcceptin interfaceJavaNode- Overrides:
jjtAcceptin classAbstractJavaNode
-
getMethodName
public java.lang.String getMethodName()
Returns the simple name of the method.
-
getName
public java.lang.String getName()
- 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.- 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
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 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
public ASTMethodDeclarator getMethodDeclarator()
Returns the method declarator. Never null.
-
getDeclaredAnnotations
public java.util.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(java.lang.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(java.lang.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(java.util.Collection<java.lang.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
-
-