- 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 byModuleLayerto create module layers return aControllerthat can be used to control modules in the layer.Unless otherwise specified, passing a nullargument to a method in this class causes aNullPointerExceptionto be thrown.- API Note:
- Care should be taken with Controllerobjects, they should never be shared with untrusted code.
- Since:
- 9
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description ModuleLayer.ControlleraddExports(Module source, String pn, Module target)Updates modulesourcein the layer to export a package to moduletarget.ModuleLayer.ControlleraddOpens(Module source, String pn, Module target)Updates modulesourcein the layer to open a package to moduletarget.ModuleLayer.ControlleraddReads(Module source, Module target)Updates modulesourcein the layer to read moduletarget.ModuleLayerlayer()Returns the layer that this object controls.
 
- 
- 
- 
Method Detail- 
layerpublic ModuleLayer layer() Returns the layer that this object controls.- Returns:
- the module layer
 
 - 
addReadspublic ModuleLayer.Controller addReads(Module source, Module target) Updates modulesourcein 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 module
- target- The target module to read
- Returns:
- This controller
- Throws:
- IllegalArgumentException- If- sourceis not in the module layer
- See Also:
- Module.addReads(java.lang.Module)
 
 - 
addExportspublic ModuleLayer.Controller addExports(Module source, String pn, Module target) Updates modulesourcein 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 module
- pn- The package name
- target- The target module
- Returns:
- This controller
- Throws:
- IllegalArgumentException- If- sourceis not in the module layer or the package is not in the source module
- See Also:
- Module.addExports(java.lang.String, java.lang.Module)
 
 - 
addOpenspublic ModuleLayer.Controller addOpens(Module source, String pn, Module target) Updates modulesourcein 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 module
- pn- The package name
- target- The target module
- Returns:
- This controller
- Throws:
- IllegalArgumentException- If- sourceis not in the module layer or the package is not in the source module
- See Also:
- Module.addOpens(java.lang.String, java.lang.Module)
 
 
- 
 
-