public class CompositeClassLoader extends ClassLoader
The Composite class loader also has registered the classloader that loaded xstream.jar and (if available) the thread's context classloader.
CompositeClassLoader loader = new CompositeClassLoader();
loader.add(MyClass.class.getClassLoader());
loader.add(new AnotherClassLoader());
loader.loadClass("com.blah.ChickenPlucker");
The above code will attempt to load a class from the following classloaders (in order):
The added classloaders are kept with weak references to allow an application container to reload classes.
Constructor and Description |
---|
CompositeClassLoader() |
Modifier and Type | Method and Description |
---|---|
void |
add(ClassLoader classLoader)
Add a loader to the n
|
Class |
loadClass(String name) |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public void add(ClassLoader classLoader)
classLoader
- public Class loadClass(String name) throws ClassNotFoundException
loadClass
in class ClassLoader
ClassNotFoundException
Copyright © 2004–2016 XStream. All rights reserved.