ModuleExportInfo (Java SE 22 & JDK 22)
Description: declaration: module: java.base, package: java.lang.classfile.attribute, interface: ModuleExportInfo
Keywords: java.lang.classfile.attribute.ModuleExportInfo interface

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

# Interface ModuleExportInfo

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

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PackageEntryPREVIEW`
  `exportedPackage()`
  Returns the exported package.
  `default Set<AccessFlag>`
  `exportsFlags()`
  Returns the flags associated with this export declaration, as a set of flag values.
  `int`
  `exportsFlagsMask()`
  Returns the flags associated with this export declaration, as a bit mask.
  `List<ModuleEntryPREVIEW>`
  `exportsTo()`
  Returns the list of modules to which this package is exported, if it is a qualified export.
  `default boolean`
  `has(AccessFlag flag)`
  Returns whether the module has the specified access flag set.
  `static ModuleExportInfoPREVIEW`
  `of(PackageEntryPREVIEW exports, int exportFlags, ModuleEntryPREVIEW... exportsTo)`
  Returns a module export description.
  `static ModuleExportInfoPREVIEW`
  `of(PackageEntryPREVIEW exports, int exportFlags, List<ModuleEntryPREVIEW> exportsTo)`
  Returns a module export description.
  `static ModuleExportInfoPREVIEW`
  `of(PackageEntryPREVIEW exports, Collection<AccessFlag> exportFlags, ModuleEntryPREVIEW... exportsTo)`
  Returns a module export description.
  `static ModuleExportInfoPREVIEW`
  `of(PackageEntryPREVIEW exports, Collection<AccessFlag> exportFlags, List<ModuleEntryPREVIEW> exportsTo)`
  Returns a module export description.
  `static ModuleExportInfoPREVIEW`
  `of(PackageDesc exports, int exportFlags, ModuleDesc... exportsTo)`
  Returns a module export description.
  `static ModuleExportInfoPREVIEW`
  `of(PackageDesc exports, int exportFlags, List<ModuleDesc> exportsTo)`
  Returns a module export description.
  `static ModuleExportInfoPREVIEW`
  `of(PackageDesc exports, Collection<AccessFlag> exportFlags, ModuleDesc... exportsTo)`
  Returns a module export description.
  `static ModuleExportInfoPREVIEW`
  `of(PackageDesc exports, Collection<AccessFlag> exportFlags, List<ModuleDesc> exportsTo)`
  Returns a module export description.

- ## Method Details

  - ### exportedPackage

    PackageEntryPREVIEW exportedPackage()
    Returns the exported package.
    Returns:
      the exported package

  - ### exportsFlagsMask

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

  - ### exportsFlags

    default Set<AccessFlag> exportsFlags()
    Returns the flags associated with this export declaration, as a set of flag values.
    Returns:
      the flags associated with this export declaration, as a set of flag values

  - ### exportsTo

    List<ModuleEntryPREVIEW> exportsTo()
    Returns the list of modules to which this package is exported, if it is a qualified export.
    Returns:
      the list of modules to which this package is exported, if it is a qualified export

  - ### has

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

  - ### of

    static ModuleExportInfoPREVIEW of(PackageEntryPREVIEW exports, int exportFlags, List<ModuleEntryPREVIEW> exportsTo)
    Returns a module export description.
    Parameters:
      `exports` - the exported package
      `exportFlags` - the export flags, as a bitmask
      `exportsTo` - the modules to which this package is exported
    Returns:
      a module export description

  - ### of

    static ModuleExportInfoPREVIEW of(PackageEntryPREVIEW exports, Collection<AccessFlag> exportFlags, List<ModuleEntryPREVIEW> exportsTo)
    Returns a module export description.
    Parameters:
      `exports` - the exported package
      `exportFlags` - the export flags
      `exportsTo` - the modules to which this package is exported
    Returns:
      a module export description

  - ### of

    static ModuleExportInfoPREVIEW of(PackageEntryPREVIEW exports, int exportFlags, ModuleEntryPREVIEW... exportsTo)
    Returns a module export description.
    Parameters:
      `exports` - the exported package
      `exportFlags` - the export flags, as a bitmask
      `exportsTo` - the modules to which this package is exported
    Returns:
      a module export description

  - ### of

    static ModuleExportInfoPREVIEW of(PackageEntryPREVIEW exports, Collection<AccessFlag> exportFlags, ModuleEntryPREVIEW... exportsTo)
    Returns a module export description.
    Parameters:
      `exports` - the exported package
      `exportFlags` - the export flags
      `exportsTo` - the modules to which this package is exported
    Returns:
      a module export description

  - ### of

    static ModuleExportInfoPREVIEW of(PackageDesc exports, int exportFlags, List<ModuleDesc> exportsTo)
    Returns a module export description.
    Parameters:
      `exports` - the exported package
      `exportFlags` - the export flags, as a bitmask
      `exportsTo` - the modules to which this package is exported
    Returns:
      a module export description

  - ### of

    static ModuleExportInfoPREVIEW of(PackageDesc exports, Collection<AccessFlag> exportFlags, List<ModuleDesc> exportsTo)
    Returns a module export description.
    Parameters:
      `exports` - the exported package
      `exportFlags` - the export flags
      `exportsTo` - the modules to which this package is exported
    Returns:
      a module export description

  - ### of

    static ModuleExportInfoPREVIEW of(PackageDesc exports, int exportFlags, ModuleDesc... exportsTo)
    Returns a module export description.
    Parameters:
      `exports` - the exported package
      `exportFlags` - the export flags, as a bitmask
      `exportsTo` - the modules to which this package is exported
    Returns:
      a module export description

  - ### of

    static ModuleExportInfoPREVIEW of(PackageDesc exports, Collection<AccessFlag> exportFlags, ModuleDesc... exportsTo)
    Returns a module export description.
    Parameters:
      `exports` - the exported package
      `exportFlags` - the export flags
      `exportsTo` - the modules to which this package is exported
    Returns:
      a module export description