edu.rice.cs.plt.reflect
Class ComposedClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by edu.rice.cs.plt.reflect.ComposedClassLoader

public class ComposedClassLoader
extends java.lang.ClassLoader

A class loader defining the search for classes and resources to first check a parent loader, and then delegate to a child loader. This allows two distinct class loading hierarchies to be merged.

One application is to reverse the usual search order: if I'm given loader c and would like to define an instance of MyLoader that delegates to c before checking its own resources, I can invoke new MyLoader(c); on the other hand, if I want to check the MyLoader's resources first, I might do so with a ComposedClassLoader: new ComposedClassLoader(new MyLoader(null), c).


Constructor Summary
ComposedClassLoader(java.lang.ClassLoader parent, java.lang.ClassLoader child)
           
 
Method Summary
protected  java.lang.Class<?> findClass(java.lang.String name)
           
protected  java.net.URL findResource(java.lang.String name)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComposedClassLoader

public ComposedClassLoader(java.lang.ClassLoader parent,
                           java.lang.ClassLoader child)
Method Detail

findClass

protected java.lang.Class<?> findClass(java.lang.String name)
                                throws java.lang.ClassNotFoundException
Overrides:
findClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException

findResource

protected java.net.URL findResource(java.lang.String name)
Overrides:
findResource in class java.lang.ClassLoader