|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.ClassLoader
org.glassfish.internal.api.DelegatingClassLoader
public class DelegatingClassLoader
This classloader has a list of classloaders called as delegates that it uses to find classes. All those delegates must have the same parent as this classloader in order to have a consistent class space. By consistent class space, I mean a class space where no two loaded class have same name. An inconsistent class space can lead to ClassCastException. This classloader does not define any class, classes are always loaded either by its parent or by one of the delegates.
| Nested Class Summary | |
|---|---|
static interface |
DelegatingClassLoader.ClassFinder
findClass method of ClassLoader is usually a protected method. |
| Constructor Summary | |
|---|---|
DelegatingClassLoader(ClassLoader parent)
|
|
DelegatingClassLoader(ClassLoader parent,
List<DelegatingClassLoader.ClassFinder> delegates)
|
|
| Method Summary | |
|---|---|
boolean |
addDelegate(DelegatingClassLoader.ClassFinder d)
Adds a ClassFinder to list of delegates. |
Class<?> |
findClass(String name)
|
protected URL |
findResource(String name)
|
protected Enumeration<URL> |
findResources(String name)
|
List<DelegatingClassLoader.ClassFinder> |
getDelegates()
|
String |
getName()
|
boolean |
removeDelegate(DelegatingClassLoader.ClassFinder d)
Removes a ClassFinder from list of delegates. |
void |
setName(String name)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DelegatingClassLoader(ClassLoader parent,
List<DelegatingClassLoader.ClassFinder> delegates)
throws IllegalArgumentException
IllegalArgumentException - when the delegate does not have same parent
as this classloader.public DelegatingClassLoader(ClassLoader parent)
| Method Detail |
|---|
public boolean addDelegate(DelegatingClassLoader.ClassFinder d)
throws IllegalStateException,
IllegalArgumentException
d - ClassFinder to add to the list of delegates
IllegalStateException - when this method is called after the
classloader has been used to load any class.
IllegalArgumentException - when the delegate does not have same parent
as this classloader.public boolean removeDelegate(DelegatingClassLoader.ClassFinder d)
d - ClassFinder to remove from the list of delegates
IllegalStateException - when this method is called after the
classloader has been used to load any class.
public Class<?> findClass(String name)
throws ClassNotFoundException
findClass in class ClassLoaderClassNotFoundExceptionprotected URL findResource(String name)
findResource in class ClassLoader
protected Enumeration<URL> findResources(String name)
throws IOException
findResources in class ClassLoaderIOExceptionpublic String getName()
public void setName(String name)
public List<DelegatingClassLoader.ClassFinder> getDelegates()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||