Module attribute (JVMS 4.7.25),
which always appears on classes that represent module descriptors.
This attribute only appears on classes, and does not permit multiple instances in a class. It has a data dependency on the constant pool.
The attribute was introduced in the Java SE Platform version 9, major version 53.
Module Attribute
Attributes#module(), ModuleDescriptor
| Modifier and Type | Class and Description |
|---|---|
| public static interface | ModuleAttribute.
A builder for |
| Modifier and Type | Method and Description |
|---|---|
| public List | |
| public default boolean | |
| public default Set | Returns: the module flags of the module, as a set of enum constantsReturns the module flags of the module, as a set of enum constants. |
| public int | Returns: the module flags of the module, as a bit maskReturns the module flags of the module, as a bit mask. |
| public ModuleEntry | |
| public Optional | Returns: the version of the module, if presentReturns the version of the module, if present. |
| public static ModuleAttribute | Returns: aModule attributethe module name moduleName, int the module flags moduleFlags, Utf8Entry the module version, may be moduleVersion, Collection<ModuleRequireInfo> nullthe required packages requires, Collection<ModuleExportInfo> the exported packages exports, Collection<ModuleOpenInfo> the opened packages opens, Collection<ClassEntry> the consumed services uses, Collection<ModuleProvideInfo> the provided services provides)Returns a |
| public static ModuleAttribute | Returns: aModule attributethe module name moduleName, Consumer<ModuleAttribute.a handler that receives a attrHandlerModuleAttributeBuilderReturns a |
| public static ModuleAttribute | Returns: aModule attributethe module name moduleName, Consumer<ModuleAttribute.a handler that receives a attrHandlerModuleAttributeBuilderReturns a |
| public List | |
| public List | Returns: the service implementations provided by this moduleReturns the service implementations provided by this module. |
| public List | |
| public List |
| exports | back to summary |
|---|---|
| public List Returns the packages exported by this module.
| |
| has | back to summary |
|---|---|
| public default boolean has(AccessFlag flag) Tests presence of module flag.
| |
| moduleFlags | back to summary |
|---|---|
| public default Set Returns the module flags of the module, as a set of enum constants.
| |
| moduleFlagsMask | back to summary |
|---|---|
| public int moduleFlagsMask() Returns the module flags of the module, as a bit mask. It is a
| |
| moduleName | back to summary |
|---|---|
| public ModuleEntry moduleName() Returns the name of the module.
| |
| moduleVersion | back to summary |
|---|---|
| public Optional Returns the version of the module, if present.
| |
| of | back to summary |
|---|---|
| public static ModuleAttribute of(ModuleEntry moduleName, int moduleFlags, Utf8Entry moduleVersion, Collection<ModuleRequireInfo> requires, Collection<ModuleExportInfo> exports, Collection<ModuleOpenInfo> opens, Collection<ClassEntry> uses, Collection<ModuleProvideInfo> provides) Returns a
| |
| of | back to summary |
|---|---|
| public static ModuleAttribute of(ModuleDesc moduleName, Consumer<ModuleAttribute. Returns a
| |
| of | back to summary |
|---|---|
| public static ModuleAttribute of(ModuleEntry moduleName, Consumer<ModuleAttribute. Returns a
| |
| opens | back to summary |
|---|---|
| public List Returns the packages opened by this module. API Note Opening a package to another module allows that other module to gain
the same full privilege access as members in this module. See
| |
| provides | back to summary |
|---|---|
| public List Returns the service implementations provided by this module.
| |
| requires | back to summary |
|---|---|
| public List Returns the modules required by this module.
| |
| uses | back to summary |
|---|---|
| public List Returns the services used by this module. Services may be discovered via
| |
Module attributes.
Module Attribute
ModuleDescriptor.Builder
| Modifier and Type | Method and Description |
|---|---|
| public ModuleAttribute. | Returns: this builderthe exported package pkge, int the export flags exportsFlagsMask, ModuleDesc... the modules to export to, or empty for an unqualified export exportsToModules)Adds an exported package. |
| public default ModuleAttribute. | Returns: this builderthe exported package pkge, Collection<AccessFlag> the export flags exportsFlags, ModuleDesc... the modules to export to, or empty for an unqualified export exportsToModules)Adds an exported package. |
| public ModuleAttribute. | Returns: this builderthe module export info exports)Adds an exported package. |
| public ModuleAttribute. | |
| public default ModuleAttribute. | |
| public ModuleAttribute. | |
| public ModuleAttribute. | Returns: this builderthe module version, may be version)nullSets the module version, which may be |
| public ModuleAttribute. | Returns: this builderthe opened package pkge, int the open package flags opensFlagsMask, ModuleDesc... the modules to open to, or empty for an unqualified open opensToModules)Opens a package. |
| public default ModuleAttribute. | Returns: this builderthe opened package pkge, Collection<AccessFlag> the open package flags opensFlags, ModuleDesc... the modules to open to, or empty for an unqualified open opensToModules)Opens a package. |
| public ModuleAttribute. | |
| public ModuleAttribute. | |
| public ModuleAttribute. | Returns: this builderthe module provides info provides)Declares provision of a service. |
| public ModuleAttribute. | Returns: this builderthe required module module, int the requires flags requiresFlagsMask, String the required module version, may be version)nullAdds a module requirement. |
| public default ModuleAttribute. | Returns: this builderthe required module module, Collection<AccessFlag> the requires flags requiresFlags, String the required module version, may be version)nullAdds a module requirement. |
| public ModuleAttribute. | Returns: this builderthe module require info requires)Adds module requirement. |
| public ModuleAttribute. | |
| public ModuleAttribute. |
| exports | back to summary |
|---|---|
| public ModuleAttribute. Adds an exported package.
| |
| exports | back to summary |
|---|---|
| public default ModuleAttribute. Adds an exported package.
| |
| exports | back to summary |
|---|---|
| public ModuleAttribute. Adds an exported package.
| |
| moduleFlags | back to summary |
|---|---|
| public ModuleAttribute. Sets the module flags.
| |
| moduleFlags | back to summary |
|---|---|
| public default ModuleAttribute. Sets the module flags.
| |
| moduleName | back to summary |
|---|---|
| public ModuleAttribute. Sets the module name.
| |
| moduleVersion | back to summary |
|---|---|
| public ModuleAttribute. Sets the module version, which may be
| |
| opens | back to summary |
|---|---|
| public ModuleAttribute. Opens a package. API Note Opening a package to another module allows that other module to gain
the same full privilege access as members in this module. See
| |
| opens | back to summary |
|---|---|
| public default ModuleAttribute. Opens a package. API Note Opening a package to another module allows that other module to gain
the same full privilege access as members in this module. See
| |
| opens | back to summary |
|---|---|
| public ModuleAttribute. Opens a package. API Note Opening a package to another module allows that other module to gain
the same full privilege access as members in this module. See
| |
| provides | back to summary |
|---|---|
| public ModuleAttribute. Declares provision of a service.
| |
| provides | back to summary |
|---|---|
| public ModuleAttribute. Declares provision of a service.
| |
| requires | back to summary |
|---|---|
| public ModuleAttribute. Adds a module requirement.
| |
| requires | back to summary |
|---|---|
| public default ModuleAttribute. Adds a module requirement.
| |
| requires | back to summary |
|---|---|
| public ModuleAttribute. Adds module requirement.
| |
| uses | back to summary |
|---|---|
| public ModuleAttribute. Declares use of a service.
| |
| uses | back to summary |
|---|---|
| public ModuleAttribute. Declares use of a service.
| |