Class ASTFormalParameter

    • Method Detail

      • isVarargs

        public boolean isVarargs()
        Returns true if this node is a varargs parameter.
      • isExplicitReceiverParameter

        public boolean isExplicitReceiverParameter()
        Returns true if this node is the explicit receiver parameter, e.g. in
         class Foo {
           abstract void foo(@Bar Foo this);
         }
         
      • isTypeInferred

        public boolean isTypeInferred()
        If true, this formal parameter represents one without explicit types. This can appear as part of a lambda expression with java11 using "var".
        See Also:
        ASTVariableDeclaratorId.isTypeInferred()
      • getVariableDeclaratorId

        public ASTVariableDeclaratorId getVariableDeclaratorId()
        Returns the declarator ID of this formal parameter.
      • isArray

        @Deprecated
        public boolean isArray()
        Deprecated.
        Returns true if this formal parameter is of an array type. This includes varargs parameters.
        Specified by:
        isArray in interface Dimensionable
      • getTypeNode

        public ASTType getTypeNode()
        Returns the type node of this formal parameter. The type of that node is not necessarily the type of the parameter itself, see ASTVariableDeclaratorId.getType().

        In particular, the type of the returned node doesn't take into account whether this formal parameter is varargs or not.

      • getType

        public Class<?> getType()
        Returns the type of this formal parameter. That type is exactly that of the variable declarator id, which means that the declarator id's type takes into account whether this parameter is varargs or not.
        Specified by:
        getType in interface TypeNode
        Overrides:
        getType in class AbstractJavaAccessTypeNode
        Returns:
        The Java Class, may return 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