Interface ASTExecutableDeclaration
-
- All Superinterfaces:
Annotatable
,ASTBodyDeclaration
,GenericNode<JavaNode>
,JavadocCommentOwner
,JavaNode
,JjtreeNode<JavaNode>
,ModifierOwner
,Node
,Reportable
,SymbolDeclaratorNode
,TextAvailableNode
,TypeParamOwnerNode
- All Known Implementing Classes:
ASTConstructorDeclaration
,ASTMethodDeclaration
public interface ASTExecutableDeclaration extends ModifierOwner, ASTBodyDeclaration, TypeParamOwnerNode, GenericNode<JavaNode>, JavadocCommentOwner
Groups method and constructor declarations under a common type.ExecutableDeclaration ::=
MethodDeclaration
|ConstructorDeclaration
Note: This interface was called ASTMethodOrConstructorDeclaration in PMD 6.
- Author:
- Clément Fournier
- Since:
- 5.8.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sourceforge.pmd.lang.java.ast.ModifierOwner
ModifierOwner.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.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, 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
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeNode
getFirstToken, getLastToken, tokens
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.ModifierOwner
getDeclaredAnnotations, getEffectiveVisibility, getModifiers, getVisibility, hasExplicitModifiers, hasModifiers, hasVisibility
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.Node
acceptVisitor, ancestors, children, compareLocation, descendants, firstChild, getAstInfo, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getImage, getIndexInParent, getLanguageVersion, getNumChildren, getReportLocation, getTextDocument, getUserMap, getXPathAttributesIterator, getXPathNodeName, 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.
-
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.
-
-