GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Overview
  • Module
  • Package
  • Use
  • Tree
  • Preview
  • New
  • Deprecated
  • Index
  • Help
  • SEARCH

This view

  • Original page
  • New address

GeezerVison is showing docs.oracle.com — ModuleLayer.Controller (Java SE 21 & JDK 21)

Module java.base
Package java.lang

Class ModuleLayer.Controller

java.lang.Object
java.lang.ModuleLayer.Controller
Enclosing class:
ModuleLayer

public static final class ModuleLayer.Controller extends Object
Controls a module layer. The static methods defined by ModuleLayer to create module layers return a Controller that can be used to control modules in the layer.

Unless otherwise specified, passing a null argument to a method in this class causes a NullPointerException to be thrown.

API Note:
Care should be taken with Controller objects, they should never be shared with untrusted code.
Since:
9
  • Method Summary

    Modifier and Type
    Method
    Description
    ModuleLayer.Controller
    addExports(Module source, String pn, Module target)
    Updates module source in the layer to export a package to module target.
    ModuleLayer.Controller
    addOpens(Module source, String pn, Module target)
    Updates module source in the layer to open a package to module target.
    ModuleLayer.Controller
    addReads(Module source, Module target)
    Updates module source in the layer to read module target.
    ModuleLayer.Controller
    enableNativeAccess(Module target)
    Preview.
    Enables native access for a module in the layer if the caller's module has native access.
    ModuleLayer
    layer()
    Returns the layer that this object controls.

    Methods declared in class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • layer

      public ModuleLayer layer()
      Returns the layer that this object controls.
      Returns:
      the module layer
    • addReads

      public ModuleLayer.Controller addReads(Module source, Module target)
      Updates module source in the layer to read module target. This method is a no-op if source already reads target.
      Implementation Note:
      Read edges added by this method are weak and do not prevent target from being GC'ed when source is strongly reachable.
      Parameters:
      source - The source module
      target - The target module to read
      Returns:
      This controller
      Throws:
      IllegalArgumentException - If source is not in the module layer
      See Also:
      • Module.addReads(java.lang.Module)
    • addExports

      public ModuleLayer.Controller addExports(Module source, String pn, Module target)
      Updates module source in the layer to export a package to module target. This method is a no-op if source already exports the package to at least target.
      Parameters:
      source - The source module
      pn - The package name
      target - The target module
      Returns:
      This controller
      Throws:
      IllegalArgumentException - If source is not in the module layer or the package is not in the source module
      See Also:
      • Module.addExports(java.lang.String, java.lang.Module)
    • addOpens

      public ModuleLayer.Controller addOpens(Module source, String pn, Module target)
      Updates module source in the layer to open a package to module target. This method is a no-op if source already opens the package to at least target.
      Parameters:
      source - The source module
      pn - The package name
      target - The target module
      Returns:
      This controller
      Throws:
      IllegalArgumentException - If source is not in the module layer or the package is not in the source module
      See Also:
      • Module.addOpens(java.lang.String, java.lang.Module)
    • enableNativeAccess

      public ModuleLayer.Controller enableNativeAccess(Module target)
      enableNativeAccess is a preview API of the Java platform.
      Programs can only use enableNativeAccess when preview features are enabled.
      Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
      Enables native access for a module in the layer if the caller's module has native access.

      This method is restricted. Restricted methods are unsafe, and, if used incorrectly, their use might crash the JVM or, worse, silently result in memory corruption. Thus, clients should refrain from depending on restricted methods, and use safe and supported functionalities, where possible.

      Parameters:
      target - The module to update
      Returns:
      This controller
      Throws:
      IllegalArgumentException - If target is not in the module layer
      IllegalCallerException - If the caller is in a module that does not have native access enabled
      Since:
      20
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.