public class SelfContainedSearchPolicy extends java.lang.Object implements SearchPolicy
This class implements a ModuleLoader search policy that assumes that all modules are self-contained. In other words, when loading a class or resource for a particular module, only that particular module's resource sources are search. No classes or resources are shared among modules.
SearchPolicy
,
Module
,
ModuleClassLoader
,
ModuleManager
Constructor and Description |
---|
SelfContainedSearchPolicy() |
Modifier and Type | Method and Description |
---|---|
java.lang.Class |
findClass(Module module,
java.lang.String name)
Simply returns null which forces the module class
loader to only search the target module's resource sources
for the specified class.
|
java.net.URL |
findResource(Module module,
java.lang.String name)
Simply returns null which forces the module class
loader to only search the target module's resource sources
for the specified resource.
|
void |
setModuleManager(ModuleManager mgr)
This method is part of the SearchPolicy interface.
|
public void setModuleManager(ModuleManager mgr) throws java.lang.IllegalStateException
setModuleManager
in interface SearchPolicy
mgr
- the module manager associated with this search policy.java.lang.IllegalStateException
- if the method is called
more than once.public java.lang.Class findClass(Module module, java.lang.String name)
findClass
in interface SearchPolicy
module
- the target module that is loading the class.name
- the name of the class being loaded.public java.net.URL findResource(Module module, java.lang.String name)
findResource
in interface SearchPolicy
module
- the target module that is loading the class.name
- the name of the resource being loaded.