A module descriptor describes a named module and defines methods to
obtain each of its components. The module descriptor for a named module
in the Java virtual machine is obtained by invoking the Module's getDescriptor method. Module descriptors can also be created using the
ModuleDescriptor. class or by reading the binary form of a
module declaration (module-info.class) using the read methods defined here.
A module descriptor describes a normal, open, or automatic
module. Normal modules and open modules describe their dependences, exported-packages, the services
that they use or provide, and other
components. Normal modules may open specific
packages. The module descriptor for an open module does not declare any
open packages (its opens method returns an empty set) but when
instantiated in the Java virtual machine then it is treated as if all
packages are open. The module descriptor for an automatic module does not
declare any dependences (except for the mandatory dependency on java.base), and does not declare any exported or open packages. Automatic
modules receive special treatment during resolution so that they read all
other modules in the configuration. When an automatic module is instantiated
in the Java virtual machine then it reads every unnamed module and is
treated as if all packages are exported and open.
ModuleDescriptor objects are immutable and safe for use by
multiple concurrent threads.
java.lang.Module
| Modifier and Type | Class and Description |
|---|---|
| public static class | ModuleDescriptor.
A builder for building |
| public static class | ModuleDescriptor.
A package exported by a module, may be qualified or unqualified. |
| public static enum | ModuleDescriptor.
A modifier on a module. |
| public static class | ModuleDescriptor.
A package opened by a module, may be qualified or unqualified. |
| public static class | ModuleDescriptor.
A service that a module provides one or more implementations of. |
| public static class | ModuleDescriptor.
A dependence upon a module. |
| public static class | ModuleDescriptor.
A module's version string. |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final Set | |
| private transient int | |
| private final String | |
| private final Set | |
| private final String | |
| private final boolean | |
| private final Set | |
| private final Set | |
| private final Set | |
| private final String | |
| private final Set | |
| private final Set | |
| private final ModuleDescriptor. |
| Access | Constructor and Description |
|---|---|
| private | ModuleDescriptor(String name, ModuleDescriptor.
|
| private | ModuleDescriptor(String name, ModuleDescriptor.
Creates a module descriptor from its components. |
| Modifier and Type | Method and Description |
|---|---|
| public Set | Returns: A possibly-empty unmodifiable set of module flagsReturns the set of the module flags. |
| private static <T extends Comparable | |
| private static <T extends Comparable | |
| public int | Returns: A negative integer, zero, or a positive integer if this module descriptor is less than, equal to, or greater than the given module descriptorThe module descriptor to compare that)Implements java. Compares this module descriptor to another. |
| public boolean | Returns: true if, and only if, the given object is a module
descriptor that is equal to this module descriptorthe object to which this object is to be compared ob)Overrides java. Tests this module descriptor for equality with the given object. |
| public Set | Returns: A possibly-empty unmodifiable set of exported packages Returns the set of |
| public int | Returns: The hash-code value for this module descriptorOverrides java. Computes a hash code for this module descriptor. |
| public boolean | Returns: true if this is an automatic module Returns |
| public boolean | |
| public Optional | |
| public Set | Returns: A possibly-empty unmodifiable set of modifiersReturns the set of module modifiers. |
| private static int | modsHashCode(Iterable<? extends Enum<?>> enums)
Generates and returns a hashcode for the enum instances. |
| private static <E extends Enum | |
| public String | |
| public static ModuleDescriptor. | Returns: A new builder that builds an automatic moduleThe module name name)Instantiates a builder to build a module descriptor for an automatic module. |
| public static ModuleDescriptor. | Returns: A new builderThe module name name, Set<ModuleDescriptor.The set of module modifiers msInstantiates a builder to build a module descriptor. |
| public static ModuleDescriptor. | |
| public static ModuleDescriptor. | Returns: A new builder that builds an open moduleThe module name name)Instantiates a builder to build a module descriptor for an open module. |
| public Set | Returns: A possibly-empty unmodifiable set of open packages Returns the set of |
| private static String | |
| public Set | Returns: A possibly-empty unmodifiable set of the packages in the moduleReturns the set of all packages in the module. |
| public Set | Returns: The possibly-empty unmodifiable set of the services that this module provides Returns the set of |
| public Optional | Returns: The string containing the version of the module or an emptyOptional if the module does not have a versionReturns the string with the possibly-unparseable version of the module. |
| public static ModuleDescriptor | Returns: The module descriptorThe input stream in, Supplier<Set<String>> A supplier that can produce the set of packages packageFinder)Reads the binary form of a module declaration from an input stream as a module descriptor. |
| public static ModuleDescriptor | Returns: The module descriptorThe input stream in)Reads the binary form of a module declaration from an input stream as a module descriptor. |
| public static ModuleDescriptor | Returns: The module descriptorThe byte buffer bb, Supplier<Set<String>> A supplier that can produce the set of packages packageFinder)Reads the binary form of a module declaration from a byte buffer as a module descriptor. |
| public static ModuleDescriptor | Returns: The module descriptorThe byte buffer bb)Reads the binary form of a module declaration from a byte buffer as a module descriptor. |
| public Set | |
| public String | Returns: A string containing the module name and, if present, its versionReturns a string containing the module name and, if present, its version. |
| public String | Returns: A string describing the moduleOverrides java. Returns a string describing the module. |
| private static <M> String | |
| public Set | Returns: A possibly-empty unmodifiable set of the binary names of the service types usedReturns the set of service dependences. |
| public Optional | Returns: This module's version, or an emptyOptional if the
module does not have a version or the version is
unparseableReturns the module version. |