|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
org.eclipse.gemini.blueprint.context.support.internal.classloader.ChainedClassLoader
public class ChainedClassLoader
Chaining class loader implementation that delegates the resource and class loading to a number of class loaders passed in.
This class loader parent (by default the AppClassLoader) can be specified and will be added automatically as the last entry in the list. Additionally, the class space of this class loader can be extended at runtime (by allowing more class loaders to be added). Note:non-OSGi class loaders are considered as special cases. As there are classes that are loaded by the Boot, Ext, App and Fwk ClassLoaders through boot delegation, this implementation tries to identify them and place them last in the chain. Otherwise, these loaders can pull in classes from outside OSGi causingClassCastException
s.
Constructor Summary | |
---|---|
ChainedClassLoader(ClassLoader[] loaders)
Constructs a new ChainedClassLoader instance. |
|
ChainedClassLoader(ClassLoader[] loaders,
ClassLoader parent)
Constructs a new ChainedClassLoader instance. |
Method Summary | |
---|---|
void |
addClassLoader(Class<?> clazz)
Adds a class loader defining the given class, to the chained class loader space. |
void |
addClassLoader(ClassLoader classLoader)
Adds the given class loader to the existing list. |
URL |
getResource(String name)
|
Class<?> |
loadClass(String name)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChainedClassLoader(ClassLoader[] loaders)
ChainedClassLoader
instance.
Equivalent to ChainedClassLoader(ClassLoader[], ClassLoader)
with the parent class loader initialized to
the AppClassLoader (practically the system bundle class loader).
Note that the AppClassLoader can be different then the ClassLoader.getSystemClassLoader()
, used by
ChainedClassLoader(ClassLoader[], ClassLoader)
if no parent is specified.
loaders
- array of non-null class loaderspublic ChainedClassLoader(ClassLoader[] loaders, ClassLoader parent)
ChainedClassLoader
instance.
loaders
- array of non-null class loadersparent
- parent class loader (can be null)Method Detail |
---|
public URL getResource(String name)
getResource
in class ClassLoader
public Class<?> loadClass(String name) throws ClassNotFoundException
loadClass
in class ClassLoader
ClassNotFoundException
public void addClassLoader(Class<?> clazz)
clazz
- public void addClassLoader(ClassLoader classLoader)
classLoader
- class loader to load classes from
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |