ClassifyingModuleLoader, DelegatingModuleLoaderpublic class ModuleLoader extends Object
| Modifier and Type | Field | Description | 
|---|---|---|
static ModuleFinder[] | 
NO_FINDERS | 
 A constant representing zero module finders. 
 | 
| Modifier | Constructor | Description | 
|---|---|---|
protected  | 
ModuleLoader() | 
 Construct a new instance. 
 | 
  | 
ModuleLoader(ModuleFinder finder) | 
 Construct a new instance. 
 | 
  | 
ModuleLoader(ModuleFinder[] finders) | 
 Construct a new instance. 
 | 
| Modifier and Type | Method | Description | 
|---|---|---|
protected Module | 
findLoadedModuleLocal(String name) | 
 Find an already-loaded module, returning  
null if the module isn't currently loaded. | 
protected Module | 
findLoadedModuleLocal(ModuleIdentifier identifier) | 
 Deprecated. 
 
Use  
findLoadedModuleLocal(String) instead. | 
protected ModuleSpec | 
findModule(String name) | 
 Find a Module's specification in this ModuleLoader by its name. 
 | 
protected ModuleSpec | 
findModule(ModuleIdentifier moduleIdentifier) | 
 Deprecated. 
 
Use  
findModule(String) instead. | 
static ModuleLoader | 
forClass(Class<?> clazz) | 
 Get the module loader for a class. 
 | 
static ModuleLoader | 
forClassLoader(ClassLoader classLoader) | 
 Get the module loader for a class loader. 
 | 
protected DependencySpec[] | 
getDependencies(Module module) | 
 Get the current dependency list for a module which was defined by this module loader, without any access checks. 
 | 
protected ModuleFinder[] | 
getFinders() | 
 Get the module finders configured for this module loader. 
 | 
String | 
getModuleDescription(Module module) | 
 Get a string representation of the given module, used in debug output and stack traces. 
 | 
Iterator<String> | 
iterateModules(String baseName,
              boolean recursive) | 
 Iterate the modules which can be located via this module loader. 
 | 
Iterator<ModuleIdentifier> | 
iterateModules(ModuleIdentifier baseIdentifier,
              boolean recursive) | 
 Deprecated. 
 
Use  
iterateModules(String, boolean) instead. | 
Module | 
loadModule(String name) | 
 Load a module based on an identifier. 
 | 
Module | 
loadModule(ModuleIdentifier identifier) | 
 Deprecated. 
 
Use  
loadModule(String) instead. | 
protected Module | 
loadModuleLocal(String name) | 
 Try to load a module from this module loader. 
 | 
protected Module | 
loadModuleLocal(ModuleIdentifier moduleIdentifier) | 
 Deprecated. 
 
Use  
loadModuleLocal(String) instead. | 
protected Module | 
preloadExportedModule(String name) | 
 Preload an "exported" module based on an identifier. 
 | 
protected Module | 
preloadExportedModule(ModuleIdentifier identifier) | 
 Deprecated. 
 
Use  
preloadModule(String) instead. | 
protected Module | 
preloadModule(String name) | 
 Preload a module based on an identifier. 
 | 
protected static Module | 
preloadModule(String name,
             ModuleLoader moduleLoader) | 
 Utility method to delegate to another module loader, accessible from subclasses. 
 | 
protected Module | 
preloadModule(ModuleIdentifier identifier) | 
 Deprecated. 
 
Use  
preloadModule(String) instead. | 
protected static Module | 
preloadModule(ModuleIdentifier identifier,
             ModuleLoader moduleLoader) | 
 Deprecated. 
 
Use  
preloadModule(String, ModuleLoader) instead. | 
protected void | 
refreshResourceLoaders(Module module) | 
 Refreshes the paths provided by resource loaders associated with the
 specified Module. 
 | 
protected void | 
relink(Module module) | 
 Relinks the dependencies associated with the specified Module. 
 | 
protected void | 
setAndRefreshResourceLoaders(Module module,
                            Collection<ResourceLoaderSpec> loaders) | 
 Replaces the resources loaders for the specified module and refreshes the
 internal path list that is derived from the loaders. 
 | 
protected void | 
setAndRelinkDependencies(Module module,
                        List<DependencySpec> dependencies) | 
 Replaces the dependencies for the specified module and relinks against
 the new modules This is an advanced method that should be used carefully,
 since it alters a live module. 
 | 
String | 
toString() | 
 Get the string representation of this module loader. 
 | 
protected boolean | 
unloadModuleLocal(String moduleId,
                 Module module) | 
 Unload a module from this module loader. 
 | 
protected void | 
unloadModuleLocal(Module module) | 
 Deprecated. 
 
use  
unloadModuleLocal(String,Module) instead | 
public static final ModuleFinder[] NO_FINDERS
protected ModuleLoader()
public ModuleLoader(ModuleFinder[] finders)
finders - the module finders to search, in orderpublic ModuleLoader(ModuleFinder finder)
finder - the single module finder to search (must not be null)public static ModuleLoader forClass(Class<?> clazz)
clazz - the classnull if the class's class loader does not belong to a module loader.public static ModuleLoader forClassLoader(ClassLoader classLoader)
classLoader - the class loadernull if the class loader does not belong to a module loader.public String toString()
public String getModuleDescription(Module module)
module - the module to describe@Deprecated public final Module loadModule(ModuleIdentifier identifier) throws ModuleLoadException
loadModule(String) instead.preloadModule(String) and then
 links the returned module if necessary.identifier - The module identifierModuleLoadException - if the Module can not be loadedpublic final Module loadModule(String name) throws ModuleLoadException
preloadModule(String) and then
 links the returned module if necessary.name - The module nameModuleLoadException - if the Module can not be loaded@Deprecated public final Iterator<ModuleIdentifier> iterateModules(ModuleIdentifier baseIdentifier, boolean recursive)
iterateModules(String, boolean) instead.baseIdentifier - the identifier to start with, or null to iterate all modulesrecursive - true to find recursively nested modules, false to only find immediately nested modulesSecurityException - if the caller does not have permission to iterate module loaderspublic final Iterator<String> iterateModules(String baseName, boolean recursive)
baseName - the identifier to start with, or null to iterate all modules; ignored if this module
 loader does not have a concept of nested modulesrecursive - true to find recursively nested modules, false to only find immediately nested
 modules; ignored if this module finder does not have a concept of nested modulesSecurityException - if the caller does not have permission to iterate module loaders@Deprecated protected Module preloadModule(ModuleIdentifier identifier) throws ModuleLoadException
preloadModule(String) instead.preloadModule(methodIdentifier.toString()) and is usually not used;
 if however a legacy subclass overrides this method, then it will be called instead of preloadModule(String),
 and that method will redirect to this one.identifier - the module identifier (must not be null)null if the module is not foundModuleLoadException - if an error occursprotected Module preloadModule(String name) throws ModuleLoadException
loadModuleLocal(String).  A delegating module loader may delegate to the appropriate module
 loader based on loader-specific criteria (via the preloadModule(String, ModuleLoader) method).name - the module identifiernull if the module is not foundModuleLoadException - if an error occursprotected Module preloadExportedModule(String name) throws ModuleLoadException
preloadModule(String).name - the module namenull if the module is not foundModuleLoadException - if an error occurs@Deprecated protected Module preloadExportedModule(ModuleIdentifier identifier) throws ModuleLoadException
preloadModule(String) instead.preloadModule(String).identifier - the module identifiernull if the module is not foundModuleLoadException - if an error occursprotected static Module preloadModule(String name, ModuleLoader moduleLoader) throws ModuleLoadException
name - the module namemoduleLoader - the module loader to delegate toModuleLoadException - if an error occurs@Deprecated protected static Module preloadModule(ModuleIdentifier identifier, ModuleLoader moduleLoader) throws ModuleLoadException
preloadModule(String, ModuleLoader) instead.identifier - the module identifiermoduleLoader - the module loader to delegate toModuleLoadException - if an error occurs@Deprecated protected final Module loadModuleLocal(ModuleIdentifier moduleIdentifier) throws ModuleLoadException
loadModuleLocal(String) instead.null if the module is not found.  The returned
 module may not yet be resolved.  The returned module may have a different name than the given identifier if
 the identifier is an alias for another module.moduleIdentifier - the module identifierModuleLoadException - if an error occurs while loading the moduleprotected final Module loadModuleLocal(String name) throws ModuleLoadException
null if the module is not found.  The returned
 module may not yet be resolved.  The returned module may have a different name than the given identifier if
 the identifier is an alias for another module.name - the module nameModuleLoadException - if an error occurs while loading the module@Deprecated protected final Module findLoadedModuleLocal(ModuleIdentifier identifier)
findLoadedModuleLocal(String) instead.null if the module isn't currently loaded.  May block
 while the loaded state of the module is in question (if the module is being concurrently loaded from another
 thread, for example).identifier - the module identifiernull if it wasn't foundprotected final Module findLoadedModuleLocal(String name)
null if the module isn't currently loaded.  May block
 while the loaded state of the module is in question (if the module is being concurrently loaded from another
 thread, for example).name - the module identifiernull if it wasn't found@Deprecated protected final void unloadModuleLocal(Module module) throws SecurityException
unloadModuleLocal(String,Module) insteadmodule - the module to unloadSecurityException - if an attempt is made to unload a module which does not belong to this module loaderSecurityException - if the module was not defined by this module loaderprotected final boolean unloadModuleLocal(String moduleId, Module module) throws SecurityException
moduleName is an alias of the given module
 then only alias mapping to module is removed. Aliased module
 with its canonical name and other aliases mapping is left intact.
 If the given moduleName is the canonical module name
 then all its alias plus canonical moduleName association mappings are removed.moduleId - the module identifiermodule - the module to unloadSecurityException - if an attempt is made to unload a module which does not belong to this module loaderSecurityException - if the module was not defined by this module loader@Deprecated protected ModuleSpec findModule(ModuleIdentifier moduleIdentifier) throws ModuleLoadException
findModule(String) instead.findModule(methodIdentifier.toString()) and is usually not used;
 if however a legacy subclass overrides this method, then it will be called instead of findModule(String),
 and that method will redirect to this one.moduleIdentifier - the module identifierModuleLoadExceptionprotected ModuleSpec findModule(String name) throws ModuleLoadException
 null. If the module is found but some problem occurred (for example, a transitive dependency failed to load)
 then this method should throw a ModuleLoadException of the relevant type.name - the module namenull if no module is found with the given identifierModuleLoadException - if any problems occur finding the moduleprotected final ModuleFinder[] getFinders()
protected void refreshResourceLoaders(Module module)
module - the module to refreshSecurityException - if the module was not defined by this module loader, or if the module loader does not
      have the required permissions associated with itprotected void setAndRefreshResourceLoaders(Module module, Collection<ResourceLoaderSpec> loaders)
relink(Module) must be called on all of them.module - the module to update and refreshloaders - the new collection of loaders the module should useSecurityException - if the module was not defined by this module loader, or if the module loader does not
      have the required permissions associated with itprotected void relink(Module module) throws ModuleLoadException
setAndRelinkDependencies(Module, java.util.List).module - the module to relinkModuleLoadException - if relinking failedSecurityException - if the module was not defined by this module loader, or if the module loader does not
      have the required permissions associated with itprotected void setAndRelinkDependencies(Module module, List<DependencySpec> dependencies) throws ModuleLoadException
relink(Module) must be
 called on all of them.module - the module to update and relinkdependencies - the new dependency listModuleLoadException - if relinking failedSecurityException - if the module was not defined by this module loader, or if the module loader does not
      have the required permissions associated with itprotected DependencySpec[] getDependencies(Module module)
SecurityException - if the module was not defined by this module loaderCopyright © 2022 JBoss by Red Hat. All rights reserved.