A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/module/ModuleDescriptor.html below:

ModuleDescriptor (Java SE 21 & JDK 21)

  • name

    Returns the module name.

    Returns:
    The module name
  • modifiers

    Returns the set of module modifiers.

    Returns:
    A possibly-empty unmodifiable set of modifiers
  • accessFlags
    Returns:
    A possibly-empty unmodifiable set of module flags
    See Java Virtual Machine Specification:
    4.7.25 The Module Attribute
    Since:
    20
    See Also:
  • isOpen

    public boolean isOpen()

    Returns true if this is an open module.

    This method is equivalent to testing if the set of modifiers contains the OPEN modifier.

    Returns:
    true if this is an open module
  • isAutomatic

    public boolean isAutomatic()

    Returns true if this is an automatic module.

    This method is equivalent to testing if the set of modifiers contains the AUTOMATIC modifier.

    Returns:
    true if this is an automatic module
  • requires

    Returns the set of Requires objects representing the module dependences.

    The set includes a dependency on "java.base" when this module is not named "java.base". If this module is an automatic module then it does not have a dependency on any module other than "java.base".

    Returns:
    A possibly-empty unmodifiable set of ModuleDescriptor.Requires objects
  • exports

    Returns the set of Exports objects representing the exported packages.

    If this module is an automatic module then the set of exports is empty.

    Returns:
    A possibly-empty unmodifiable set of exported packages
  • opens

    Returns the set of Opens objects representing the open packages.

    If this module is an open module or an automatic module then the set of open packages is empty.

    Returns:
    A possibly-empty unmodifiable set of open packages
  • uses

    Returns the set of service dependences.

    If this module is an automatic module then the set of service dependences is empty.

    Returns:
    A possibly-empty unmodifiable set of the fully qualified class names of the service types used
  • provides

    Returns the set of Provides objects representing the services that the module provides.

    Returns:
    The possibly-empty unmodifiable set of the services that this module provides
  • version

    Returns the module version.

    Returns:
    This module's version, or an empty Optional if the module does not have a version or the version is unparseable
  • rawVersion

    Returns the string with the possibly-unparseable version of the module.

    Returns:
    The string containing the version of the module or an empty Optional if the module does not have a version
    See Also:
  • toNameAndVersion public String toNameAndVersion

    ()

    Returns a string containing the module name and, if present, its version.

    Returns:
    A string containing the module name and, if present, its version
  • mainClass

    Returns the module main class.

    Returns:
    The fully qualified class name of the module's main class
  • packages

    The set of packages includes all exported and open packages, as well as the packages of any service providers, and the package for the main class.

    Returns:
    A possibly-empty unmodifiable set of the packages in the module
  • compareTo

    Two ModuleDescriptor objects are compared by comparing their module names lexicographically. Where the module names are equal then the module versions are compared. When comparing the module versions then a module descriptor with a version is considered to succeed a module descriptor that does not have a version. If both versions are unparseable then the raw version strings are compared lexicographically. Where the module names are equal and the versions are equal (or not present in both), then the set of modifiers are compared. Sets of modifiers are compared by comparing a binary value computed for each set. If a modifier is present in the set then the bit at the position of its ordinal is 1 in the binary value, otherwise 0. If the two set of modifiers are also equal then the other components of the module descriptors are compared in a manner that is consistent with equals.

    Specified by:
    compareTo in interface Comparable<ModuleDescriptor>
    Parameters:
    that - The module descriptor to compare
    Returns:
    A negative integer, zero, or a positive integer if this module descriptor is less than, equal to, or greater than the given module descriptor
  • equals public boolean equals(Object ob)

    Tests this module descriptor for equality with the given object.

    If the given object is not a ModuleDescriptor then this method returns false. Two module descriptors are equal if each of their corresponding components is equal.

    This method satisfies the general contract of the Object.equals method.

    Overrides:
    equals in class Object
    Parameters:
    ob - the object to which this object is to be compared
    Returns:
    true if, and only if, the given object is a module descriptor that is equal to this module descriptor
    See Also:
  • hashCode

    public int hashCode()

    The hash code is based upon the components of the module descriptor, and satisfies the general contract of the Object.hashCode method.

    Overrides:
    hashCode in class Object
    Returns:
    The hash-code value for this module descriptor
    See Also:
  • toString

    Returns a string describing the module.

    Overrides:
    toString in class Object
    Returns:
    A string describing the module
  • newModule

    Instantiates a builder to build a module descriptor.

    Parameters:
    name - The module name
    ms - The set of module modifiers
    Returns:
    A new builder
    Throws:
    IllegalArgumentException - If the module name is null or is not a legal module name, or the set of modifiers contains AUTOMATIC with other modifiers
  • newModule

    Instantiates a builder to build a module descriptor for a

    normal

    module. This method is equivalent to invoking

    newModule

    with an empty set of

    modifiers

    .

    Parameters:
    name - The module name
    Returns:
    A new builder
    Throws:
    IllegalArgumentException - If the module name is null or is not a legal module name
  • newOpenModule

    Instantiates a builder to build a module descriptor for an open module. This method is equivalent to invoking

    newModule

    with the

    OPEN

    modifier.

    The builder for an open module cannot be used to declare any open packages.

    Parameters:
    name - The module name
    Returns:
    A new builder that builds an open module
    Throws:
    IllegalArgumentException - If the module name is null or is not a legal module name
  • newAutomaticModule

    Instantiates a builder to build a module descriptor for an automatic module. This method is equivalent to invoking

    newModule

    with the

    AUTOMATIC

    modifier.

    The builder for an automatic module cannot be used to declare module or service dependences. It also cannot be used to declare any exported or open packages.

    Parameters:
    name - The module name
    Returns:
    A new builder that builds an automatic module
    Throws:
    IllegalArgumentException - If the module name is null or is not a legal module name
    See Also:
  • read

    Reads the binary form of a module declaration from an input stream as a module descriptor.

    If the descriptor encoded in the input stream does not indicate a set of packages in the module then the packageFinder will be invoked. The set of packages that the packageFinder returns must include all the packages that the module exports, opens, as well as the packages of the service implementations that the module provides, and the package of the main class (if the module has a main class). If the packageFinder throws an UncheckedIOException then IOException cause will be re-thrown.

    If there are bytes following the module descriptor then it is implementation specific as to whether those bytes are read, ignored, or reported as an InvalidModuleDescriptorException. If this method fails with an InvalidModuleDescriptorException or IOException then it may do so after some, but not all, bytes have been read from the input stream. It is strongly recommended that the stream be promptly closed and discarded if an exception occurs.

    API Note:
    The packageFinder parameter is for use when reading module descriptors from legacy module-artifact formats that do not record the set of packages in the descriptor itself.
    Parameters:
    in - The input stream
    packageFinder - A supplier that can produce the set of packages
    Returns:
    The module descriptor
    Throws:
    InvalidModuleDescriptorException - If an invalid module descriptor is detected or the set of packages returned by the packageFinder does not include all of the packages obtained from the module descriptor
    IOException - If an I/O error occurs reading from the input stream or UncheckedIOException is thrown by the package finder
  • read

    Reads the binary form of a module declaration from an input stream as a module descriptor. This method works exactly as specified by the 2-arg

    read

    method with the exception that a package finder is not used to find additional packages when the module descriptor read from the stream does not indicate the set of packages.

    Parameters:
    in - The input stream
    Returns:
    The module descriptor
    Throws:
    InvalidModuleDescriptorException - If an invalid module descriptor is detected
    IOException - If an I/O error occurs reading from the input stream
  • read

    Reads the binary form of a module declaration from a byte buffer as a module descriptor.

    If the descriptor encoded in the byte buffer does not indicate a set of packages in the module then the packageFinder will be invoked. The set of packages that the packageFinder returns must include all the packages that the module exports, opens, as well as the packages of the service implementations that the module provides, and the package of the main class (if the module has a main class). If the packageFinder throws an UncheckedIOException then IOException cause will be re-thrown.

    The module descriptor is read from the buffer starting at index p, where p is the buffer's position when this method is invoked. Upon return the buffer's position will be equal to p + n where n is the number of bytes read from the buffer.

    If there are bytes following the module descriptor then it is implementation specific as to whether those bytes are read, ignored, or reported as an InvalidModuleDescriptorException. If this method fails with an InvalidModuleDescriptorException then it may do so after some, but not all, bytes have been read.

    API Note:
    The packageFinder parameter is for use when reading module descriptors from legacy module-artifact formats that do not record the set of packages in the descriptor itself.
    Parameters:
    bb - The byte buffer
    packageFinder - A supplier that can produce the set of packages
    Returns:
    The module descriptor
    Throws:
    InvalidModuleDescriptorException - If an invalid module descriptor is detected or the set of packages returned by the packageFinder does not include all of the packages obtained from the module descriptor
  • read

    Reads the binary form of a module declaration from a byte buffer as a module descriptor. This method works exactly as specified by the 2-arg

    read

    method with the exception that a package finder is not used to find additional packages when the module descriptor encoded in the buffer does not indicate the set of packages.

    Parameters:
    bb - The byte buffer
    Returns:
    The module descriptor
    Throws:
    InvalidModuleDescriptorException - If an invalid module descriptor is detected

  • RetroSearch is an open source project built by @garambo | Open a GitHub Issue

    Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

    HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4