ModuleElement.OpensDirective (Java SE 26 & JDK 26)
Description: declaration: module: java.compiler, package: javax.lang.model.element, interface: ModuleElement, interface: OpensDirective
Keywords: javax.lang.model.element.ModuleElement.OpensDirective interface

# Interface ModuleElement.OpensDirective

All Superinterfaces:
  `ModuleElement.Directive`

Enclosing interface:
  `ModuleElement`

public static interface ModuleElement.OpensDirective extends ModuleElement.Directive
An opened package of a module.

Since:
  9

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PackageElement`
  `getPackage()`
  Returns the package being opened.
  `List<? extends ModuleElement>`
  `getTargetModules()`
  Returns the specific modules to which the package is being open or `null`, if the package is open all modules which have readability to this module.

  ### Methods declared in interface ModuleElement.Directive

  `accept, getKind`
  Modifier and Type
  Method
  Description
  `<R,P> R`
  `accept(ModuleElement.DirectiveVisitor<R,P> v, P p)`
  Applies a visitor to this directive.
  `ModuleElement.DirectiveKind`
  `getKind()`
  Returns the `kind` of this directive.

- ## Method Details

  - ### getPackage

    PackageElement getPackage()
    Returns the package being opened.
    Returns:
      the package being opened

  - ### getTargetModules

    List<? extends ModuleElement> getTargetModules()
    Returns the specific modules to which the package is being open or `null`, if the package is open all modules which have readability to this module.
    Returns:
      the specific modules to which the package is being opened