public sealed interface ModuleRequireInfo
ModuleRequireInfo
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.
Models a single "requires" declaration in the
ModuleAttribute
PREVIEW.- Since:
- 22
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
has
(AccessFlag flag) Returns whether the specific access flag is set.static ModuleRequireInfoPREVIEW
of
(ModuleEntryPREVIEW requires, int requiresFlags, Utf8EntryPREVIEW requiresVersion) Returns a module requirement description.static ModuleRequireInfoPREVIEW
of
(ModuleEntryPREVIEW requires, Collection<AccessFlag> requiresFlags, Utf8EntryPREVIEW requiresVersion) Returns a module requirement description.static ModuleRequireInfoPREVIEW
of
(ModuleDesc requires, int requiresFlags, String requiresVersion) Returns a module requirement description.static ModuleRequireInfoPREVIEW
of
(ModuleDesc requires, Collection<AccessFlag> requiresFlags, String requiresVersion) Returns a module requirement description.requires()
Returns The module on which the current module depends.default Set
<AccessFlag> Returns the access flags.int
Returns the flags associated with this require declaration, as a bit mask.Returns the required version of the required module, if present.
-
Method Details
-
requires
ModuleEntryPREVIEW requires()Returns The module on which the current module depends.- Returns:
- The module on which the current module depends
-
requiresFlagsMask
int requiresFlagsMask()Returns the flags associated with this require declaration, as a bit mask. Valid flags includeClassFile.ACC_TRANSITIVE
PREVIEW,ClassFile.ACC_STATIC_PHASE
PREVIEW,ClassFile.ACC_SYNTHETIC
PREVIEW andClassFile.ACC_MANDATED
PREVIEW- Returns:
- the flags associated with this require declaration, as a bit mask
-
requiresFlags
-
requiresVersion
-
has
Returns whether the specific access flag is set.- Parameters:
flag
- the access flag- Returns:
- whether the specific access flag is set
-
of
static ModuleRequireInfoPREVIEW of(ModuleEntryPREVIEW requires, int requiresFlags, Utf8EntryPREVIEW requiresVersion) Returns a module requirement description.- Parameters:
requires
- the required modulerequiresFlags
- the require-specific flagsrequiresVersion
- the required version- Returns:
- a module requirement description
-
of
static ModuleRequireInfoPREVIEW of(ModuleEntryPREVIEW requires, Collection<AccessFlag> requiresFlags, Utf8EntryPREVIEW requiresVersion) Returns a module requirement description.- Parameters:
requires
- the required modulerequiresFlags
- the require-specific flagsrequiresVersion
- the required version- Returns:
- a module requirement description
-
of
Returns a module requirement description.- Parameters:
requires
- the required modulerequiresFlags
- the require-specific flagsrequiresVersion
- the required version- Returns:
- a module requirement description
-
of
static ModuleRequireInfoPREVIEW of(ModuleDesc requires, Collection<AccessFlag> requiresFlags, String requiresVersion) Returns a module requirement description.- Parameters:
requires
- the required modulerequiresFlags
- the require-specific flagsrequiresVersion
- the required version- Returns:
- a module requirement description
-
ModuleRequireInfo
when preview features are enabled.