Class TypeDeclarationStatement


  • public class TypeDeclarationStatement
    extends Statement
    Local type declaration statement AST node type.

    This kind of node is used to convert a type declaration node into a statement node by wrapping it.

     TypeDeclarationStatement:
        TypeDeclaration
        EnumDeclaration
     
    Although allowed at the AST, not all arrangements of AST nodes are meaningful; in particular, only class and enum declarations are meaningful in the context of a block.
    Since:
    2.0
    Restriction:
    This class is not intended to be instantiated by clients.
    • Method Detail

      • propertyDescriptors

        public static List propertyDescriptors​(int apiLevel)
        Returns a list of structural property descriptors for this node type. Clients must not modify the result.
        Parameters:
        apiLevel - the API level; one of the AST.JLS* constants
        Returns:
        a list of property descriptors (element type: StructuralPropertyDescriptor)
        Since:
        3.0
      • getDeclaration

        public AbstractTypeDeclaration getDeclaration()
        Returns the abstract type declaration of this local type declaration statement (added in JLS3 API).
        Returns:
        the type declaration node
        Since:
        3.1
      • setDeclaration

        public void setDeclaration​(AbstractTypeDeclaration decl)
        Sets the abstract type declaration of this local type declaration statement (added in JLS3 API).
        Parameters:
        decl - the type declaration node
        Throws:
        IllegalArgumentException - if:
        • the node belongs to a different AST
        • the node already has a parent
        • a cycle in would be created
        Since:
        3.1
      • getTypeDeclaration

        public TypeDeclaration getTypeDeclaration()
        Deprecated.
        In the JLS3 API, this method is replaced by getDeclaration(), which returns AbstractTypeDeclaration instead of TypeDeclaration.
        Returns the type declaration of this local type declaration statement (JLS2 API only).
        Returns:
        the type declaration node
        Throws:
        UnsupportedOperationException - if this operation is used in an AST later than JLS2
      • setTypeDeclaration

        public void setTypeDeclaration​(TypeDeclaration decl)
        Deprecated.
        In the JLS3 API, this method is replaced by setDeclaration(AbstractTypeDeclaration) which takes AbstractTypeDeclaration instead of TypeDeclaration.
        Sets the type declaration of this local type declaration statement (JLS2 API only).
        Parameters:
        decl - the type declaration node
        Throws:
        IllegalArgumentException - if:
        • the node belongs to a different AST
        • the node already has a parent
        • a cycle in would be created
        UnsupportedOperationException - if this operation is used in an AST later than JLS2
      • resolveBinding

        public ITypeBinding resolveBinding()
        Resolves and returns the binding for the class or interface declared in this type declaration statement.

        Note that bindings are generally unavailable unless requested when the AST is being built.

        Returns:
        the binding, or null if the binding cannot be resolved