Class ModuleDeclaration


  • public class ModuleDeclaration
    extends ASTNode
    Module declaration AST node type representing the module descriptor file (added in JLS9 API).
     ModuleDeclaration:
      [ Javadoc ] { Annotation } [ open ] module Name {
            { RequiresDirective | ExportsDirective | OpensDirective | UsesDirective | ProvidesDirective }
      }
     

    Since:
    3.14
    Restriction:
    This class is not intended to be subclassed by clients.
    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)
      • getJavadoc

        public Javadoc getJavadoc()
        Returns the doc comment node.
        Returns:
        the doc comment node, or null if none
      • setJavadoc

        public void setJavadoc​(Javadoc docComment)
        Sets or clears the doc comment node.
        Parameters:
        docComment - the doc comment node, or null if none
        Throws:
        IllegalArgumentException - if the doc comment string is invalid
      • annotations

        public List annotations()
        Returns the live ordered list of annotations of this declaration.
        Returns:
        the live list of annotations (element type: Annotation)
      • isOpen

        public boolean isOpen()
        Returns whether this module declaration is open or not.
        Returns:
        true if this is open, else false
      • setOpen

        public void setOpen​(boolean isOpen)
        Sets whether this module declaration is open or not.
        Parameters:
        isOpen - true if this is an open module, and false if not
      • getName

        public Name getName()
        Returns the name of this module declaration.
        Returns:
        the module name
      • setName

        public void setName​(Name name)
        Sets the module name in to the given name.
        Parameters:
        name - the new module name
        Throws:
        IllegalArgumentException - if:
        • the node belongs to a different AST
        • the node already has a parent
      • moduleStatements

        public List moduleStatements()
        Returns the live list of statements in this module. Adding and removing nodes from this list affects this node dynamically. All nodes in this list must be ModuleDirectives; attempts to add any other type of node will trigger an exception.
        Returns:
        the live list of statements in this module declaration (element type: ModuleDirective)
      • resolveBinding

        public IModuleBinding resolveBinding()
        Resolves and returns the binding for the module.

        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