abbot.util
Class NonDelegatingClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
abbot.util.PathClassLoader
abbot.util.NonDelegatingClassLoader
- Direct Known Subclasses:
- AppClassLoader
public class NonDelegatingClassLoader
- extends PathClassLoader
Provides support for loading a class before checking the parent
class loader for it. If the shouldDelegate method returns false for a
given class name, it will defer to its parent class loader only if the
class is not found in this loader's path. This provides a means for
reloading classes that would otherwise be permanently cached by the app
or boot class loaders.
The name for this class is not quite correct; it will delegate to
its parent if it doesn't find a given class.
Method Summary |
Class |
findClass(String name)
Find the given class in the search path. |
protected Class |
loadClass(String name,
boolean resolve)
Load the given class, but attempt to load before the parent if
shouldDelegate returns false for the given class. |
protected boolean |
shouldDelegate(String name)
Returns whether the given class should be given to the parent class
loader to try before this one does. |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
NonDelegatingClassLoader
public NonDelegatingClassLoader(String path,
ClassLoader parent)
shouldDelegate
protected boolean shouldDelegate(String name)
- Returns whether the given class should be given to the parent class
loader to try before this one does. The default implementation always
returns false. Making this method return true will revert to the
standard class loader behavior.
findClass
public Class findClass(String name)
throws ClassNotFoundException
- Find the given class in the search path.
- Overrides:
findClass
in class URLClassLoader
- Throws:
ClassNotFoundException
loadClass
protected Class loadClass(String name,
boolean resolve)
throws ClassNotFoundException
- Load the given class, but attempt to load before the parent if
shouldDelegate returns false for the given class.
- Overrides:
loadClass
in class PathClassLoader
- Throws:
ClassNotFoundException
Copyright © 2002-2008 Timothy Wall. All Rights Reserved.
Abbot is hosted on