Interface PackageDesc

All Known Implementing Classes:
PackageDescImpl

public sealed interface PackageDesc permits PackageDescImpl
A nominal descriptor for a Package constant.

To create a PackageDesc for a package, use of(java.lang.String) or ofInternalName(String).

  • Method Details

    • of

      static PackageDesc of(String name)
      Returns a PackageDesc for a package, given the name of the package, such as "java.lang".

      Parameters:
      name - the fully qualified (dot-separated) binary package name
      Returns:
      a PackageDesc describing the desired package
      Throws:
      NullPointerException - if the argument is null
      IllegalArgumentException - if the name string is not in the correct format
    • ofInternalName

      static PackageDesc ofInternalName(String name)
      Returns a PackageDesc for a package, given the name of the package in internal form, such as "java/lang".

      In this internal form, the ASCII periods (.) that normally separate the identifiers which make up the binary name are replaced by ASCII forward slashes (/).

      Parameters:
      name - the fully qualified class name, in internal (slash-separated) form
      Returns:
      a PackageDesc describing the desired package
      Throws:
      NullPointerException - if the argument is null
      IllegalArgumentException - if the name string is not in the correct format
    • packageInternalName

      String packageInternalName()
      Returns the fully qualified (slash-separated) internal package name of this PackageDesc.
      Returns:
      the package name, or the empty string for the default package
    • packageName

      default String packageName()
      Returns the fully qualified (dot-separated) binary package name of this PackageDesc.
      Returns:
      the package name, or the empty string for the default package
    • 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 PackageDesc and both describe the same package.
      Overrides:
      equals in class Object
      Parameters:
      o - the other object
      Returns:
      whether this descriptor is equal to the other object