Class ASTMethodDeclaration

    • Constructor Detail

      • ASTMethodDeclaration

        @InternalApi
        @Deprecated
        public ASTMethodDeclaration​(int id)
        Deprecated.
      • ASTMethodDeclaration

        @InternalApi
        @Deprecated
        public ASTMethodDeclaration​(JavaParser p,
                                    int id)
        Deprecated.
    • Method Detail

      • jjtAccept

        public java.lang.Object jjtAccept​(JavaParserVisitor visitor,
                                          java.lang.Object data)
        Description copied from interface: JavaNode
        Calls back the visitor's visit method corresponding to the runtime type of this Node.
        Specified by:
        jjtAccept in interface JavaNode
        Overrides:
        jjtAccept in class AbstractJavaNode
        Parameters:
        visitor - Visitor to dispatch
        data - Visit data
      • getMethodName

        @Deprecated
        public java.lang.String getMethodName()
        Deprecated.
        Returns the simple name of the method.
      • getName

        public java.lang.String getName()
        Returns the simple name of the method.
        Specified by:
        getName in interface net.sourceforge.pmd.lang.dfa.DFAGraphMethod
      • 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.
      • getDeclaredAnnotations

        public java.util.List<ASTAnnotation> getDeclaredAnnotations()
        Description copied from interface: Annotatable
        Get all annotations present on this node.
        Specified by:
        getDeclaredAnnotations in interface Annotatable
        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 interface Annotatable
        Parameters:
        annotQualifiedName - qulified name of the annotation.
        Returns:
        ASTAnnotaion node if the annotation is present on this node, else null
      • 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 interface Annotatable
        Parameters:
        annotQualifiedName - qulified name of the annotation.
        Returns:
        true if the annotation is present on this node, else false
      • 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 interface Annotatable
        Parameters:
        annotQualifiedNames - collection that cotains qulified name of annotations.
        Returns:
        true if any annotation is present on this node, else false