Interface ModuleRequireInfo


public sealed interface ModuleRequireInfo
Models a single "requires" declaration in the ModuleAttribute.
Since:
24
See Also:
  • Method Details

    • requires

      ModuleEntry 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. It is in the range of unsigned short, [0, 0xFFFF].
      Returns:
      the flags associated with this require declaration, as a bit mask
      See Also:
    • requiresFlags

      default Set<AccessFlag> requiresFlags()
      Returns the flags associated with this require declaration, as a set of flag enums.
      Returns:
      the flags associated with this require declaration, as a set of flag enums
      Throws:
      IllegalArgumentException - if the flags mask has any undefined bit set
      See Also:
    • requiresVersion

      Optional<Utf8Entry> requiresVersion()
      Returns the required version of the required module, if present.
      Returns:
      the required version of the required module, if present
      See Also:
    • 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
      See Also:
    • of

      static ModuleRequireInfo of(ModuleEntry requires, int requiresFlags, Utf8Entry requiresVersion)
      Returns a module requirement description.
      Parameters:
      requires - the required module
      requiresFlags - the require-specific flags
      requiresVersion - the required version, may be null
      Returns:
      a module requirement description
    • of

      static ModuleRequireInfo of(ModuleEntry requires, Collection<AccessFlag> requiresFlags, Utf8Entry requiresVersion)
      Returns a module requirement description.
      Parameters:
      requires - the required module
      requiresFlags - the require-specific flags
      requiresVersion - the required version, may be null
      Returns:
      a module requirement description
      Throws:
      IllegalArgumentException - if any flag cannot be applied to the AccessFlag.Location.MODULE_REQUIRES location
    • of

      static ModuleRequireInfo 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, may be null
      Returns:
      a module requirement description
    • of

      static ModuleRequireInfo 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, may be null
      Returns:
      a module requirement description
      Throws:
      IllegalArgumentException - if any flag cannot be applied to the AccessFlag.Location.MODULE_REQUIRES location