ModuleLayer.Controller (Java SE 13 & JDK 13 )
- 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
Controllerobjects, they should never be shared with untrusted code. - Since:
- 9
-
Method Details
-
layer
Returns the layer that this object controls.
- Returns:
- the module layer
-
addReads
Updates module
sourcein the layer to read moduletarget. This method is a no-op ifsourcealready readstarget.- Implementation Note:
- Read edges added by this method are weak
and do not prevent
targetfrom being GC'ed whensourceis strongly reachable. - Parameters:
source- The source moduletarget- The target module to read- Returns:
- This controller
- Throws:
IllegalArgumentException- Ifsourceis not in the module layer- See Also:
Module.addReads(java.lang.Module)
-
addExports
Updates module
sourcein the layer to export a package to moduletarget. This method is a no-op ifsourcealready exports the package to at leasttarget.- Parameters:
source- The source modulepn- The package nametarget- The target module- Returns:
- This controller
- Throws:
IllegalArgumentException- Ifsourceis 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
Updates module
sourcein the layer to open a package to moduletarget. This method is a no-op ifsourcealready opens the package to at leasttarget.- Parameters:
source- The source modulepn- The package nametarget- The target module- Returns:
- This controller
- Throws:
IllegalArgumentException- Ifsourceis not in the module layer or the package is not in the source module- See Also:
Module.addOpens(java.lang.String, java.lang.Module)
-
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2019, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.