|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ClassLoaderProvider
Definition of an interface for objects that act as a registry for class loaders.
In complex environments different class loaders can play an important role. Thus the dependency injection framework supports the registration of arbitrary class loaders; they are assigned a symbolic name. When a class is loaded, a class loader can be specified by the symbolic name it was registered.
This interface provides access to the registered class loaders by their symbolic name. It can be used by components that need to load class per reflection.
| Field Summary | |
|---|---|
static java.lang.String |
CONTEXT_CLASS_LOADER
Constant for the reserved name of the context class loader. |
| Method Summary | |
|---|---|
java.util.Set<java.lang.String> |
classLoaderNames()
Returns a set with the names of all registered class loaders. |
java.lang.ClassLoader |
getClassLoader(java.lang.String name)
Returns a reference to the class loader with the specified symbolic name. |
java.lang.ClassLoader |
getDefaultClassLoader()
Returns the default class loader used for dynamically loading classes. |
java.lang.Class<?> |
loadClass(java.lang.String name,
java.lang.String loaderRef)
Returns the class specified by the given name. |
void |
registerClassLoader(java.lang.String name,
java.lang.ClassLoader loader)
Allows to register a ClassLoader by name. |
void |
setDefaultClassLoader(java.lang.ClassLoader loader)
Sets the default class loader. |
| Field Detail |
|---|
static final java.lang.String CONTEXT_CLASS_LOADER
getClassLoader() method, the
context class loader will automatically be used.
| Method Detail |
|---|
java.lang.ClassLoader getClassLoader(java.lang.String name)
CONTEXT_CLASS_LOADER can be
passed in, too, for obtaining a reference to the context class loader. In
all other cases the parameter is interpreted as the symbolic name of a
registered class loader. If no class loader is found under this name, an
exception will be thrown.
name - the name of the desired class loader
InjectionException - if the class loader cannot be resolved
java.lang.Class<?> loadClass(java.lang.String name,
java.lang.String loaderRef)
name - the name of the class to be loaded (must not be null)loaderRef - the name, under which the desired class loader is
registered (null for the default class loader)
InjectionException - if the class cannot be loaded
java.lang.IllegalArgumentException - if the class name is null, or if
the reference to the class loader cannot be resolved
void registerClassLoader(java.lang.String name,
java.lang.ClassLoader loader)
ClassLoader by name. This class
loader can later be accessed using the getClassLoader()
method. If the class loader reference is null, the class loader
with the given name will be unregistered.
name - a symbolic name for the class loader (must not be null)loader - the class loader to be registered
java.lang.IllegalArgumentException - if the name is undefinedjava.lang.ClassLoader getDefaultClassLoader()
void setDefaultClassLoader(java.lang.ClassLoader loader)
loader - the new default class loaderjava.util.Set<java.lang.String> classLoaderNames()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||