Class ASTMethodDeclaration

    • Method Detail

      • getMethodName

        @Deprecated
        @DeprecatedAttribute(replaceWith="@Name")
        public String getMethodName()
        Deprecated.
        Returns the simple name of the method.
      • isSyntacticallyPublic

        public boolean isSyntacticallyPublic()
        Returns true if this method is explicitly modified by the public modifier.
      • isSyntacticallyAbstract

        public boolean isSyntacticallyAbstract()
        Returns true if this method is explicitly modified by the abstract modifier.
      • isPublic

        public boolean isPublic()
        Returns true if this method has public visibility. Non-private interface members are implicitly public, whether they declare the public modifier or not.
        Specified by:
        isPublic in interface AccessNode
        Overrides:
        isPublic in class AbstractJavaAccessNode
      • 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 the abstract modifier or not. Default interface methods are not abstract though, consistently with the standard reflection API.
        Specified by:
        isAbstract in interface AccessNode
        Overrides:
        isAbstract in class AbstractJavaAccessNode
      • 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 is void.
      • getResultType

        public ASTResultType getResultType()
        Returns the result type node of the method.
      • getBlock

        @Deprecated
        public ASTBlock getBlock()
        Deprecated.
        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 the throws 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 interface MethodLikeNode
        Returns:
        The kind of method-like
      • getMethodDeclarator

        @Deprecated
        public ASTMethodDeclarator getMethodDeclarator()
        Deprecated.
        Method declarator nodes will be removed with 7.0.0
        Returns the method declarator. Never null.
      • getAnnotation

        public ASTAnnotation getAnnotation​(String binaryName)
        Description copied from interface: Annotatable
        Returns a specific annotation on this node, or null if absent.
        Specified by:
        getAnnotation in interface Annotatable
        Parameters:
        binaryName - Binary name of the annotation type. Note: for now, canonical names are tolerated, this may be changed in PMD 7.
      • isAnnotationPresent

        public boolean isAnnotationPresent​(String binaryName)
        Description copied from interface: Annotatable
        Checks whether the annotation is present on this node.
        Specified by:
        isAnnotationPresent in interface Annotatable
        Parameters:
        binaryName - Binary name of the annotation type. Note: for now, canonical names are tolerated, this may be changed in PMD 7.
        Returns:
        true if the annotation is present on this node, else false
      • isAnyAnnotationPresent

        public boolean isAnyAnnotationPresent​(Collection<String> binaryNames)
        Description copied from interface: Annotatable
        Checks whether any annotation is present on this node.
        Specified by:
        isAnyAnnotationPresent in interface Annotatable
        Parameters:
        binaryNames - Collection that contains binary names of annotations. Note: for now, canonical names are tolerated, this may be changed in PMD 7.
        Returns:
        true if any annotation is present on this node, else false