com.opensymphony.oscache.util
Class ClassLoaderUtil
java.lang.Object
com.opensymphony.oscache.util.ClassLoaderUtil
- public class ClassLoaderUtil
- extends Object
This code is borrowed directly from OSCore, but is duplicated
here to avoid having to add a dependency on the entire OSCore jar.
If much more code from OSCore is needed then it might be wiser to
bite the bullet and add a dependency.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassLoaderUtil
public ClassLoaderUtil()
loadClass
public static Class loadClass(String className,
Class callingClass)
throws ClassNotFoundException
- Load a class with a given name.
It will try to load the class in the following order:
- From Thread.currentThread().getContextClassLoader()
- Using the basic Class.forName()
- From ClassLoaderUtil.class.getClassLoader()
- From the callingClass.getClassLoader()
- Parameters:
className
- The name of the class to loadcallingClass
- The Class object of the calling object
- Throws:
ClassNotFoundException
- If the class cannot be found anywhere.