Interface ModuleDesc

All Known Implementing Classes:
ModuleDescImpl

public sealed interface ModuleDesc permits ModuleDescImpl
A nominal descriptor for a Module constant.

To create a ModuleDesc for a module, use of(java.lang.String).

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compare the specified object with this descriptor for equality.
    Returns the module name of this ModuleDesc.
    static ModuleDesc
    of(String name)
    Returns a ModuleDesc for a module, given the name of the module.
  • Method Details

    • of

      static ModuleDesc of(String name)
      Returns a ModuleDesc for a module, given the name of the module.

      Module names are not encoded in "internal form" like class and interface names, that is, the ASCII periods (.) that separate the identifiers in a module name are not replaced by ASCII forward slashes (/).

      Module names may be drawn from the entire Unicode codespace, subject to the following constraints:

      • A module name must not contain any code point in the range '\u0000' to '\u001F' inclusive.
      • The ASCII backslash (\) is reserved for use as an escape character in module names. It must not appear in a module name unless it is followed by an ASCII backslash, an ASCII colon (:), or an ASCII at-sign (@). The ASCII character sequence \\ may be used to encode a backslash in a module name.
      • The ASCII colon (:) and at-sign (@) are reserved for future use in module names. They must not appear in module names unless they are escaped. The ASCII character sequences \: and \@ may be used to encode a colon and an at-sign in a module name.
      Parameters:
      name - module name
      Returns:
      a ModuleDesc describing the desired module
      Throws:
      NullPointerException - if the argument is null
      IllegalArgumentException - if the name string is not in the correct format
    • moduleName

      String moduleName()
      Returns the module name of this ModuleDesc.
      Returns:
      the module name
    • equals

      boolean equals(Object o)
      Compare the specified object with this descriptor for equality. Returns true if and only if the specified object is also a ModuleDesc and both describe the same module.
      Overrides:
      equals in class Object
      Parameters:
      o - the other object
      Returns:
      whether this descriptor is equal to the other object