Class RequiresDirective


  • public class RequiresDirective
    extends ModuleDirective
    Requires directive AST node type (added in JLS9 API).
     RequiresDirective:
         requires { ModuleModifier } Name ;
     
    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)
      • modifiers

        public List modifiers()
        Returns the live ordered list of modifiers of this declaration.

        Note that the not all modifiers are legal.

        Returns:
        the live list of module modifiers (element type: ModuleModifier)
      • getModifiers

        public int getModifiers()
        Returns the module modifiers explicitly specified on this declaration.

        This method is a convenience method that computes these flags from modifiers().

        Returns:
        the bit-wise or of ModuleModifier constants
        See Also:
        ModuleModifier
      • getName

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

        public void setName​(Name name)
        Sets the module name in requires directive 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