Module java.base
Package java.lang.module

Class ModuleDescriptor

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

public classModuleDescriptorextendsObjectimplementsComparable<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 theModule'sgetDescriptor method. Module descriptors can also be created using theModuleDescriptor.Builder class or by reading the binary form of a module declaration (module-info.class) using theread methods defined here.

A module descriptor describes anormal, open, or automatic module.Normal modules and open modules describe theirdependences,exported-packages, the services that theyuse orprovide, and other components.Normal modules mayopen specific packages. The module descriptor for an open module does not declare any open packages (itsopens 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: