Interface ASTMethodOrConstructorDeclaration
-
- All Superinterfaces:
AccessNode
,Annotatable
,ASTBodyDeclaration
,GenericNode<JavaNode>
,JavadocCommentOwner
,JavaNode
,JjtreeNode<JavaNode>
,Node
,Reportable
,SymbolDeclaratorNode
,TextAvailableNode
,TypeParamOwnerNode
- All Known Implementing Classes:
ASTConstructorDeclaration
,ASTMethodDeclaration
public interface ASTMethodOrConstructorDeclaration extends AccessNode, ASTBodyDeclaration, TypeParamOwnerNode, GenericNode<JavaNode>, JavadocCommentOwner
Groups method and constructor declarations under a common type.MethodOrConstructorDeclaration ::=
MethodDeclaration
|ConstructorDeclaration
- Since:
- 5.8.1
- Author:
- Clément Fournier
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sourceforge.pmd.lang.java.ast.AccessNode
AccessNode.Visibility
-
-
Field Summary
-
Fields inherited from interface net.sourceforge.pmd.lang.ast.Node
COORDS_COMPARATOR
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
getArity()
Returns the number of formal parameters expected by this declaration.default @Nullable ASTBlock
getBody()
Returns the body of this method or constructor.default @NonNull ASTFormalParameters
getFormalParameters()
Returns the formal parameters node of this method or constructor.JMethodSig
getGenericSignature()
Returns the generic signature for the method.String
getName()
Returns the name of the method, or the simple name of the declaring class for a constructor declaration.JExecutableSymbol
getSymbol()
Returns the symbol this node declares.default @Nullable ASTThrowsList
getThrowsList()
Returns thethrows
clause of this declaration, or null if there is none.default boolean
isAbstract()
Returns true if this method is abstract, so doesn't declare a body.default boolean
isVarargs()
Returns true if this node's last formal parameter is varargs.-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.AccessNode
getDeclaredAnnotations, getEffectiveVisibility, getModifiers, getVisibility, hasExplicitModifiers, hasModifiers, isFinal, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isSyntacticallyAbstract, isSyntacticallyFinal, isSyntacticallyPublic, isSyntacticallyStatic, isTransient, isVolatile
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.Annotatable
getAnnotation, isAnnotationPresent, isAnnotationPresent, isAnyAnnotationPresent
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.impl.GenericNode
ancestors, ancestorsOrSelf, asStream, children, descendants, descendantsOrSelf, getChild, getFirstChild, getLastChild, getNextSibling, getNthParent, getParent, getPreviousSibling
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavadocCommentOwner
getJavadocComment
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaNode
getEnclosingType, getRoot, getSymbolTable, getTypeSystem, jjtAccept
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeNode
getFirstToken, getLastToken, tokens
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.Node
acceptVisitor, ancestors, children, compareLocation, descendants, findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, firstChild, getAstInfo, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfType, getImage, getIndexInParent, getLanguageVersion, getNumChildren, getParentsOfType, getReportLocation, getTextDocument, getUserMap, getXPathAttributesIterator, getXPathNodeName, hasDescendantOfType, hasImageEqualTo, isFindBoundary
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.TextAvailableNode
getOriginalText, getText, getTextRegion
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.TypeParamOwnerNode
getTypeParameters
-
-
-
-
Method Detail
-
getSymbol
JExecutableSymbol getSymbol()
Description copied from interface:SymbolDeclaratorNode
Returns the symbol this node declares.- Specified by:
getSymbol
in interfaceSymbolDeclaratorNode
- Specified by:
getSymbol
in interfaceTypeParamOwnerNode
-
getGenericSignature
JMethodSig getGenericSignature()
Returns the generic signature for the method. This is aJMethodSig
declared in the generic type declaration of the enclosing type. The signature may mention type parameters of the enclosing types, and its own type parameters.
-
getName
String getName()
Returns the name of the method, or the simple name of the declaring class for a constructor declaration.
-
isAbstract
default 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. Default interface methods are not abstract though, consistently with the standard reflection API.- Specified by:
isAbstract
in interfaceAccessNode
-
getFormalParameters
default @NonNull ASTFormalParameters getFormalParameters()
Returns the formal parameters node of this method or constructor.
-
getArity
default int getArity()
Returns the number of formal parameters expected by this declaration. This excludes any receiver parameter, which is irrelevant to arity.
-
getBody
default @Nullable ASTBlock getBody()
Returns the body of this method or constructor. Returns null if this is the declaration of an abstract method.
-
getThrowsList
default @Nullable ASTThrowsList getThrowsList()
Returns thethrows
clause of this declaration, or null if there is none.
-
isVarargs
default boolean isVarargs()
Returns true if this node's last formal parameter is varargs.
-
-