|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.freecompany.brimstone.module.DelegatingClassLoader
public class DelegatingClassLoader
The delegating class loader maintains a list of delegates to which looading commands will be propagated. This list is always traversed in order of insertion.
Field Summary | |
---|---|
protected org.freecompany.util.multicaster.Notification |
notifier
|
Constructor Summary | |
---|---|
DelegatingClassLoader()
Creates an delegating class loader with no parent and no source URL s. |
|
DelegatingClassLoader(java.lang.ClassLoader parent)
Creates an delegating class loader with no source URL s
which uses the provided parent loader. |
|
DelegatingClassLoader(java.net.URL[] urls)
Creates an delegating class loader with no parent and with the specified source URL s. |
|
DelegatingClassLoader(java.net.URL[] urls,
java.lang.ClassLoader parent)
Creates an delegating class loader with the specified source URL s
and which uses the provided parent loader. |
Method Summary | |
---|---|
void |
addDelegate(java.lang.ClassLoader loader)
Adds a class loader to the list of delegates. |
void |
addUrl(java.net.URL url)
Exposes the ability to add locations to this class loader at runtime. |
protected java.lang.String |
dump()
Dumps a string representation of the current threads local stack. |
java.net.URL |
getResource(java.lang.String name)
Gets a resource using the contained set of delegates. |
java.util.Enumeration<java.net.URL> |
getResources(java.lang.String name)
Gets a set of resources using the contained set of delegates. |
java.lang.Class |
loadClass(java.lang.String name,
boolean resolve)
Loads a class using the contained set of delegates. |
protected org.freecompany.util.core.Pair<java.lang.ClassLoader,java.lang.String> |
pop()
Pops the Pair on the top of the stack. |
protected void |
push(org.freecompany.util.core.Pair<java.lang.ClassLoader,java.lang.String> pair)
Pushes a new Pair onto the thread local stack. |
protected boolean |
searching(java.lang.String name)
Checks to see if the provided name is currently in the process of being loaded. |
protected static java.lang.String |
shortName(java.lang.Class clazz)
Strips extra characters from a fully qualified class name, leaving only the name within the package. |
protected boolean |
skip(java.lang.ClassLoader child,
java.lang.String name)
Checks the thread local state to determine whether the provided child needs to be skipped. |
java.lang.String |
toString()
|
Methods inherited from class java.net.URLClassLoader |
---|
addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
---|
defineClass, defineClass |
Methods inherited from class java.lang.ClassLoader |
---|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected org.freecompany.util.multicaster.Notification notifier
Constructor Detail |
---|
public DelegatingClassLoader()
URL
s.
public DelegatingClassLoader(java.lang.ClassLoader parent)
URL
s
which uses the provided parent loader.
public DelegatingClassLoader(java.net.URL[] urls)
URL
s.
public DelegatingClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent)
URL
s
and which uses the provided parent loader.
Method Detail |
---|
public void addUrl(java.net.URL url)
URLClassLoader.addURL(java.net.URL)
method
so as to avoid interfering with normal operation.
url
- the url to add to the list of locations searched for class definitions.public void addDelegate(java.lang.ClassLoader loader)
ClassLoader
must not have this delegating class loader set as
it's parent unless it is an instance of InvertedClassLoader
or
can otherwise make use of the methods in this loader that take a source as a
parameter.
loader
- the ClassLoader
to add to the delegate list.public java.lang.Class loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
name
- the name of the class to load.
Class
definition found by this loader.
java.lang.ClassNotFoundException
- if the class can not be found.public java.util.Enumeration<java.net.URL> getResources(java.lang.String name) throws java.io.IOException
getResources
in class java.lang.ClassLoader
name
- the name of the resource to list.
URL>
of resources found by this class loader.
java.io.IOException
public java.net.URL getResource(java.lang.String name)
getResource
in class java.lang.ClassLoader
name
- the name of the resource to get.
URL
of the resource found by this class loader or
null
if no resource was found.protected static final java.lang.String shortName(java.lang.Class clazz)
clazz
- the Class
for which to construct a short name.
public java.lang.String toString()
toString
in class java.lang.Object
protected void push(org.freecompany.util.core.Pair<java.lang.ClassLoader,java.lang.String> pair)
Pair
onto the thread local stack.
pair
- the pair of elements describing the latest loading event.protected org.freecompany.util.core.Pair<java.lang.ClassLoader,java.lang.String> pop()
Pair
on the top of the stack.
EmptyStackException
- if there are no entries on the stack.protected boolean searching(java.lang.String name)
ClassLoader.loadClass( String)
call.
name
- the current class being loaded.protected boolean skip(java.lang.ClassLoader child, java.lang.String name)
child
- child class loader to test.name
- the name of the resource being loaded.
boolean
indicating whether this child should be skipped.protected final java.lang.String dump()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |