Class ASTFormalParameter

    • Constructor Detail

      • ASTFormalParameter

        public ASTFormalParameter​(int id)
      • ASTFormalParameter

        public ASTFormalParameter​(JavaParser p,
                                  int id)
    • Method Detail

      • setVarargs

        @Deprecated
        public void setVarargs()
        Deprecated.
        Will be made private in 7.0.0
      • 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 explit 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 java.lang.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.
      • setType

        public void setType​(java.lang.Class<?> type)
        Noop, the type of this node is defined by the type of the declarator id.
        Specified by:
        setType in interface TypeNode
        Overrides:
        setType in class AbstractJavaAccessTypeNode
        Parameters:
        type - A Java Class
      • 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