public class ProxyClassLoader extends ClassLoader
Constructor and Description |
---|
ProxyClassLoader(ClassLoader[] parents,
boolean transitive)
Create a multi-parented classloader.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addCoveredPackages(Iterable<String> coveredPackages) |
void |
append(ClassLoader[] nueparents)
Add new parents dynamically.
|
protected Package |
definePackage(String name,
String specTitle,
String specVersion,
String specVendor,
String implTitle,
String implVersion,
String implVendor,
URL sealBase)
This is here just for locking serialization purposes.
|
void |
destroy()
Called before releasing the classloader so it can itself unregister
from the global ClassLoader pool
|
protected Class<?> |
doLoadClass(String pkg,
String name)
This ClassLoader can't load anything itself.
|
protected Class<?> |
findClass(String name) |
URL |
findResource(String name)
This ClassLoader can't load anything itself.
|
Enumeration<URL> |
findResources(String name) |
protected Package |
getPackage(String name)
Returns a Package that has been defined by this class loader or any
of its parents.
|
protected Package |
getPackageFast(String name,
boolean recurse)
Faster way to find a package.
|
protected Package[] |
getPackages()
Returns all of the Packages defined by this class loader and its parents.
|
URL |
getResource(String name)
Finds the resource with the given name.
|
Enumeration<URL> |
getResources(String name) |
protected Class<?> |
loadClass(String name,
boolean resolve)
Loads the class with the specified name.
|
protected void |
setSystemClassLoader(ClassLoader s) |
protected boolean |
shouldDelegateResource(String pkg,
ClassLoader parent) |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getParent, getPlatformClassLoader, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public ProxyClassLoader(ClassLoader[] parents, boolean transitive)
parents
- all direct parents of this classloader, except system one.transitive
- whether other PCLs depending on this one will
automatically search through its parent listpublic void append(ClassLoader[] nueparents) throws IllegalArgumentException
nueparents
- the new parents to add (append to list)IllegalArgumentException
- in case of a null or cyclic parent (duplicate OK)protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
loadClass
in class ClassLoader
name
- the name of the classresolve
- if true
then resolve the classClass
objectClassNotFoundException
- if the class could not be foundprotected Class<?> findClass(String name) throws ClassNotFoundException
findClass
in class ClassLoader
ClassNotFoundException
protected Class<?> doLoadClass(String pkg, String name)
null
if it can't load required class.name
- the name of the classClass
object or null
public final URL getResource(String name)
getResource
in class ClassLoader
name
- a "/"-separated path name that identifies the resource.null
if
the resource could not be found.ProxyClassLoader.findResource(String)
public URL findResource(String name)
findResource
in class ClassLoader
name
- the resource namenull
if the resource could not be found.public final Enumeration<URL> getResources(String name) throws IOException
getResources
in class ClassLoader
IOException
public Enumeration<URL> findResources(String name) throws IOException
findResources
in class ClassLoader
IOException
protected Package getPackage(String name)
getPackage
in class ClassLoader
name
- the package nameprotected Package getPackageFast(String name, boolean recurse)
name
- package name in org.netbeans.modules.foo formatsname
- package name in org/netbeans/modules/foo/ formatrecurse
- whether to also ask parentsprotected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException
definePackage
in class ClassLoader
IllegalArgumentException
protected Package[] getPackages()
getPackages
in class ClassLoader
Package
objects defined by this
ClassLoader
protected final void setSystemClassLoader(ClassLoader s)
protected boolean shouldDelegateResource(String pkg, ClassLoader parent)
public void destroy()