- All Superinterfaces:
Attribute<ModuleAttribute>,ClassElement,ClassFileElement,WritableElement<ModuleAttribute>
- All Known Implementing Classes:
BoundAttribute.BoundModuleAttribute,UnboundAttribute.UnboundModuleAttribute
public sealed interface ModuleAttribute
extends Attribute<ModuleAttribute>, ClassElement
permits BoundAttribute.BoundModuleAttribute, UnboundAttribute.UnboundModuleAttribute
Models the
Module attribute , which can
appear on classes that represent module descriptors.
Delivered as a ClassElement when
traversing the elements of a ClassModel.
The attribute does not permit multiple instances in a given location. Subsequent occurrence of the attribute takes precedence during the attributed element build or transformation.
The attribute was introduced in the Java SE Platform version 9.
- Since:
- 22
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA builder for module attributes. -
Method Summary
Modifier and TypeMethodDescriptionexports()Returns the packages exported by this module.default booleanhas(AccessFlag flag) Tests presence of module flagdefault Set<AccessFlag> Returns the the module flags of the module, as a set of enum constants.intReturns the the module flags of the module, as a bit mask.Returns the name of the module.Returns the version of the module, if present.static ModuleAttributeof(ModuleDesc moduleName, Consumer<ModuleAttribute.ModuleAttributeBuilder> attrHandler) Returns aModuleattribute.static ModuleAttributeof(ModuleEntry moduleName, int moduleFlags, Utf8Entry moduleVersion, Collection<ModuleRequireInfo> requires, Collection<ModuleExportInfo> exports, Collection<ModuleOpenInfo> opens, Collection<ClassEntry> uses, Collection<ModuleProvideInfo> provides) Returns aModuleattribute.static ModuleAttributeof(ModuleEntry moduleName, Consumer<ModuleAttribute.ModuleAttributeBuilder> attrHandler) Returns aModuleattribute.opens()Returns the packages opened by this module.provides()Returns the service implementations provided by this module.requires()Returns the modules required by this module.uses()Returns the services used by this module.Methods inherited from interface org.glavo.classfile.Attribute
attributeMapper, attributeNameMethods inherited from interface org.glavo.classfile.WritableElement
writeTo
-
Method Details
-
moduleName
ModuleEntry moduleName()Returns the name of the module.- Returns:
- the name of the module
-
moduleFlagsMask
int moduleFlagsMask()Returns the the module flags of the module, as a bit mask.- Returns:
- the the module flags of the module, as a bit mask
-
moduleFlags
Returns the the module flags of the module, as a set of enum constants.- Returns:
- the the module flags of the module, as a set of enum constants
-
has
Tests presence of module flag- Parameters:
flag- the module flag- Returns:
- true if the flag is set
-
moduleVersion
Returns the version of the module, if present.- Returns:
- the version of the module, if present
-
requires
List<ModuleRequireInfo> requires()Returns the modules required by this module.- Returns:
- the modules required by this module
-
exports
List<ModuleExportInfo> exports()Returns the packages exported by this module.- Returns:
- the packages exported by this module
-
opens
List<ModuleOpenInfo> opens()Returns the packages opened by this module.- Returns:
- the packages opened by this module
-
uses
List<ClassEntry> uses()Returns the services used by this module. Services may be discovered viaServiceLoader.- Returns:
- the services used by this module
-
provides
List<ModuleProvideInfo> provides()Returns the service implementations provided by this module.- Returns:
- the service implementations provided by this module
-
of
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 aModuleattribute.- Parameters:
moduleName- the module namemoduleFlags- the module flagsmoduleVersion- the module versionrequires- the required packagesexports- the exported packagesopens- the opened packagesuses- the consumed servicesprovides- the provided services- Returns:
- a
Moduleattribute
-
of
static ModuleAttribute of(ModuleDesc moduleName, Consumer<ModuleAttribute.ModuleAttributeBuilder> attrHandler) Returns aModuleattribute.- Parameters:
moduleName- the module nameattrHandler- a handler that receives aModuleAttribute.ModuleAttributeBuilder- Returns:
- a
Moduleattribute
-
of
static ModuleAttribute of(ModuleEntry moduleName, Consumer<ModuleAttribute.ModuleAttributeBuilder> attrHandler) Returns aModuleattribute.- Parameters:
moduleName- the module nameattrHandler- a handler that receives aModuleAttribute.ModuleAttributeBuilder- Returns:
- a
Moduleattribute
-