Module java.base

Class ModuleDescriptor

java.lang.Object
java.lang.module.ModuleDescriptor
All Implemented Interfaces:
Comparable<ModuleDescriptor>

public class ModuleDescriptor extends Object implements Comparable<ModuleDescriptor>
A module descriptor.

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.Builder 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.

Since:
9
See Also: