Interface ModuleRequireInfo


public sealed interface ModuleRequireInfo
ModuleRequireInfo is a preview API of the Java platform.
Programs can only use ModuleRequireInfo when preview features are enabled.
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 ModuleAttributePREVIEW.
Since:
22
  • 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 include ClassFile.ACC_TRANSITIVEPREVIEW, ClassFile.ACC_STATIC_PHASEPREVIEW, ClassFile.ACC_SYNTHETICPREVIEW and ClassFile.ACC_MANDATEDPREVIEW
      Returns:
      the flags associated with this require declaration, as a bit mask
    • requiresFlags

      default Set<AccessFlag> requiresFlags()
      Returns the access flags.
      Returns:
      the access flags
    • requiresVersion

      Optional<Utf8EntryPREVIEW> requiresVersion()
      Returns the required version of the required module, if present.
      Returns:
      the required version of the required module, if present
    • has

      default boolean has(AccessFlag flag)
      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 module
      requiresFlags - the require-specific flags
      requiresVersion - 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 module
      requiresFlags - the require-specific flags
      requiresVersion - the required version
      Returns:
      a module requirement description
    • of

      static ModuleRequireInfoPREVIEW of(ModuleDesc requires, int requiresFlags, String requiresVersion)
      Returns a module requirement description.
      Parameters:
      requires - the required module
      requiresFlags - the require-specific flags
      requiresVersion - 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 module
      requiresFlags - the require-specific flags
      requiresVersion - the required version
      Returns:
      a module requirement description