Module java.base
Package java.lang.classfile.attributePREVIEW

# Interface ModuleOpenInfo

public sealed interface ModuleOpenInfo
`ModuleOpenInfo` is a preview API of the Java platform.
Programs can only use `ModuleOpenInfo` 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 "opens" declaration in the `ModuleAttribute`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default boolean`
  `has(AccessFlag flag)`
  Returns whether the specified access flag is set.
  `static ModuleOpenInfoPREVIEW`
  `of(PackageEntryPREVIEW opens, int opensFlags, ModuleEntryPREVIEW... opensTo)`
  Returns a module open description.
  `static ModuleOpenInfoPREVIEW`
  `of(PackageEntryPREVIEW opens, int opensFlags, List<ModuleEntryPREVIEW> opensTo)`
  Returns a module open description.
  `static ModuleOpenInfoPREVIEW`
  `of(PackageEntryPREVIEW opens, Collection<AccessFlag> opensFlags, ModuleEntryPREVIEW... opensTo)`
  Returns a module open description.
  `static ModuleOpenInfoPREVIEW`
  `of(PackageEntryPREVIEW opens, Collection<AccessFlag> opensFlags, List<ModuleEntryPREVIEW> opensTo)`
  Returns a module open description.
  `static ModuleOpenInfoPREVIEW`
  `of(PackageDesc opens, int opensFlags, ModuleDesc... opensTo)`
  Returns a module open description.
  `static ModuleOpenInfoPREVIEW`
  `of(PackageDesc opens, int opensFlags, List<ModuleDesc> opensTo)`
  Returns a module open description.
  `static ModuleOpenInfoPREVIEW`
  `of(PackageDesc opens, Collection<AccessFlag> opensFlags, ModuleDesc... opensTo)`
  Returns a module open description.
  `static ModuleOpenInfoPREVIEW`
  `of(PackageDesc opens, Collection<AccessFlag> opensFlags, List<ModuleDesc> opensTo)`
  Returns a module open description.
  `PackageEntryPREVIEW`
  `openedPackage()`
  Returns the package being opened.
  `default Set<AccessFlag>`
  `opensFlags()`
  Returns the access flags.
  `int`
  `opensFlagsMask()`
  Returns the flags associated with this open declaration, as a bit mask.
  `List<ModuleEntryPREVIEW>`
  `opensTo()`
  The list of modules to which this package is opened, if it is a qualified open.

- ## Method Details

  - ### openedPackage

    PackageEntryPREVIEW openedPackage()
    Returns the package being opened.
    Returns:
      the package being opened

  - ### opensFlagsMask

    int opensFlagsMask()
    Returns the flags associated with this open declaration, as a bit mask. Valid flags include `ClassFile.ACC_SYNTHETIC`PREVIEW and `ClassFile.ACC_MANDATED`PREVIEW
    Returns:
      the flags associated with this open declaration, as a bit mask

  - ### opensFlags

    default Set<AccessFlag> opensFlags()
    Returns the access flags.
    Returns:
      the access flags

  - ### has

    default boolean has(AccessFlag flag)
    Returns whether the specified access flag is set.
    Parameters:
      `flag` - the access flag
    Returns:
      whether the specified access flag is set

  - ### opensTo

    List<ModuleEntryPREVIEW> opensTo()
    The list of modules to which this package is opened, if it is a qualified open.
    Returns:
      the modules to which this package is opened

  - ### of

    static ModuleOpenInfoPREVIEW of(PackageEntryPREVIEW opens, int opensFlags, List<ModuleEntryPREVIEW> opensTo)
    Returns a module open description.
    Parameters:
      `opens` - the package to open
      `opensFlags` - the open flags
      `opensTo` - the packages to which this package is opened, if it is a qualified open
    Returns:
      a module open description

  - ### of

    static ModuleOpenInfoPREVIEW of(PackageEntryPREVIEW opens, Collection<AccessFlag> opensFlags, List<ModuleEntryPREVIEW> opensTo)
    Returns a module open description.
    Parameters:
      `opens` - the package to open
      `opensFlags` - the open flags
      `opensTo` - the packages to which this package is opened, if it is a qualified open
    Returns:
      a module open description

  - ### of

    static ModuleOpenInfoPREVIEW of(PackageEntryPREVIEW opens, int opensFlags, ModuleEntryPREVIEW... opensTo)
    Returns a module open description.
    Parameters:
      `opens` - the package to open
      `opensFlags` - the open flags
      `opensTo` - the packages to which this package is opened, if it is a qualified open
    Returns:
      a module open description

  - ### of

    static ModuleOpenInfoPREVIEW of(PackageEntryPREVIEW opens, Collection<AccessFlag> opensFlags, ModuleEntryPREVIEW... opensTo)
    Returns a module open description.
    Parameters:
      `opens` - the package to open
      `opensFlags` - the open flags
      `opensTo` - the packages to which this package is opened, if it is a qualified open
    Returns:
      a module open description

  - ### of

    static ModuleOpenInfoPREVIEW of(PackageDesc opens, int opensFlags, List<ModuleDesc> opensTo)
    Returns a module open description.
    Parameters:
      `opens` - the package to open
      `opensFlags` - the open flags
      `opensTo` - the packages to which this package is opened, if it is a qualified open
    Returns:
      a module open description

  - ### of

    static ModuleOpenInfoPREVIEW of(PackageDesc opens, Collection<AccessFlag> opensFlags, List<ModuleDesc> opensTo)
    Returns a module open description.
    Parameters:
      `opens` - the package to open
      `opensFlags` - the open flags
      `opensTo` - the packages to which this package is opened, if it is a qualified open
    Returns:
      a module open description

  - ### of

    static ModuleOpenInfoPREVIEW of(PackageDesc opens, int opensFlags, ModuleDesc... opensTo)
    Returns a module open description.
    Parameters:
      `opens` - the package to open
      `opensFlags` - the open flags
      `opensTo` - the packages to which this package is opened, if it is a qualified open
    Returns:
      a module open description

  - ### of

    static ModuleOpenInfoPREVIEW of(PackageDesc opens, Collection<AccessFlag> opensFlags, ModuleDesc... opensTo)
    Returns a module open description.
    Parameters:
      `opens` - the package to open
      `opensFlags` - the open flags
      `opensTo` - the packages to which this package is opened, if it is a qualified open
    Returns:
      a module open description