Interface ModuleAttribute.ModuleAttributeBuilder
- Enclosing interface:
ModuleAttributePREVIEW
public static sealed interface ModuleAttribute.ModuleAttributeBuilder
ModuleAttributeBuilder
is a preview API of the Java platform.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A builder for module attributes.
- Since:
- 22
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds module attribute.exports
(ModuleExportInfoPREVIEW exports) Adds exported packageexports
(PackageDesc pkge, int exportsFlagsMask, ModuleDesc... exportsToModules) Adds exported packageexports
(PackageDesc pkge, Collection<AccessFlag> exportsFlags, ModuleDesc... exportsToModules) Adds exported packagemoduleFlags
(int flagsMask) Sets the module flagsmoduleFlags
(AccessFlag... moduleFlags) Sets the module flagsmoduleName
(ModuleDesc moduleName) Sets the module namemoduleVersion
(String version) Sets the module versionopens
(ModuleOpenInfoPREVIEW opens) Opens packageopens
(PackageDesc pkge, int opensFlagsMask, ModuleDesc... opensToModules) Opens packageopens
(PackageDesc pkge, Collection<AccessFlag> opensFlags, ModuleDesc... opensToModules) Opens packageprovides
(ModuleProvideInfoPREVIEW provides) Declares provision of a serviceDeclares provision of a servicerequires
(ModuleRequireInfoPREVIEW requires) Adds module requirementrequires
(ModuleDesc module, int requiresFlagsMask, String version) Adds module requirementrequires
(ModuleDesc module, Collection<AccessFlag> requiresFlags, String version) Adds module requirementuses
(ClassEntryPREVIEW uses) Declares use of a serviceDeclares use of a service
-
Method Details
-
moduleName
Sets the module name- Parameters:
moduleName
- the module name- Returns:
- this builder
-
moduleFlags
Sets the module flags- Parameters:
flagsMask
- the module flags- Returns:
- this builder
-
moduleFlags
Sets the module flags- Parameters:
moduleFlags
- the module flags- Returns:
- this builder
-
moduleVersion
Sets the module version- Parameters:
version
- the module version- Returns:
- this builder
-
requires
ModuleAttribute.ModuleAttributeBuilderPREVIEW requires(ModuleDesc module, int requiresFlagsMask, String version) Adds module requirement- Parameters:
module
- the required modulerequiresFlagsMask
- the requires flagsversion
- the required module version- Returns:
- this builder
-
requires
default ModuleAttribute.ModuleAttributeBuilderPREVIEW requires(ModuleDesc module, Collection<AccessFlag> requiresFlags, String version) Adds module requirement- Parameters:
module
- the required modulerequiresFlags
- the requires flagsversion
- the required module version- Returns:
- this builder
-
requires
Adds module requirement- Parameters:
requires
- the module require info- Returns:
- this builder
-
exports
ModuleAttribute.ModuleAttributeBuilderPREVIEW exports(PackageDesc pkge, int exportsFlagsMask, ModuleDesc... exportsToModules) Adds exported package- Parameters:
pkge
- the exported packageexportsFlagsMask
- the export flagsexportsToModules
- the modules to export to- Returns:
- this builder
-
exports
default ModuleAttribute.ModuleAttributeBuilderPREVIEW exports(PackageDesc pkge, Collection<AccessFlag> exportsFlags, ModuleDesc... exportsToModules) Adds exported package- Parameters:
pkge
- the exported packageexportsFlags
- the export flagsexportsToModules
- the modules to export to- Returns:
- this builder
-
exports
Adds exported package- Parameters:
exports
- the module export info- Returns:
- this builder
-
opens
ModuleAttribute.ModuleAttributeBuilderPREVIEW opens(PackageDesc pkge, int opensFlagsMask, ModuleDesc... opensToModules) Opens package- Parameters:
pkge
- the opened packageopensFlagsMask
- the open package flagsopensToModules
- the modules to open to- Returns:
- this builder
-
opens
default ModuleAttribute.ModuleAttributeBuilderPREVIEW opens(PackageDesc pkge, Collection<AccessFlag> opensFlags, ModuleDesc... opensToModules) Opens package- Parameters:
pkge
- the opened packageopensFlags
- the open package flagsopensToModules
- the modules to open to- Returns:
- this builder
-
opens
Opens package- Parameters:
opens
- the module open info- Returns:
- this builder
-
uses
Declares use of a service- Parameters:
service
- the service class used- Returns:
- this builder
- Throws:
IllegalArgumentException
- ifservice
represents a primitive type
-
uses
Declares use of a service- Parameters:
uses
- the service class used- Returns:
- this builder
-
provides
Declares provision of a service- Parameters:
service
- the service class providedimplClasses
- the implementation classes- Returns:
- this builder
- Throws:
IllegalArgumentException
- ifservice
or any of theimplClasses
represents a primitive type
-
provides
Declares provision of a service- Parameters:
provides
- the module provides info- Returns:
- this builder
-
build
-
ModuleAttributeBuilder
when preview features are enabled.