public class ShadowingClassLoader extends DecoratingClassLoader
addTransformer(java.lang.instrument.ClassFileTransformer)
,
OverridingClassLoader
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
DEFAULT_EXCLUDED_PACKAGES
Packages that are excluded by default
|
Constructor and Description |
---|
ShadowingClassLoader(java.lang.ClassLoader enclosingClassLoader)
Create a new ShadowingClassLoader, decorating the given ClassLoader,
applying
DEFAULT_EXCLUDED_PACKAGES . |
ShadowingClassLoader(java.lang.ClassLoader enclosingClassLoader,
boolean defaultExcludes)
Create a new ShadowingClassLoader, decorating the given ClassLoader.
|
Modifier and Type | Method and Description |
---|---|
void |
addTransformer(java.lang.instrument.ClassFileTransformer transformer)
Add the given ClassFileTransformer to the list of transformers that this
ClassLoader will apply.
|
void |
copyTransformers(ShadowingClassLoader other)
Copy all ClassFileTransformers from the given ClassLoader to the list of
transformers that this ClassLoader will apply.
|
java.net.URL |
getResource(java.lang.String name) |
java.io.InputStream |
getResourceAsStream(java.lang.String name) |
java.util.Enumeration<java.net.URL> |
getResources(java.lang.String name) |
protected boolean |
isEligibleForShadowing(java.lang.String className)
Determine whether the specified class is eligible for shadowing
by this class loader.
|
java.lang.Class<?> |
loadClass(java.lang.String name) |
excludeClass, excludePackage, isExcluded
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public static final java.lang.String[] DEFAULT_EXCLUDED_PACKAGES
public ShadowingClassLoader(java.lang.ClassLoader enclosingClassLoader)
DEFAULT_EXCLUDED_PACKAGES
.enclosingClassLoader
- the ClassLoader to decorateShadowingClassLoader(ClassLoader, boolean)
public ShadowingClassLoader(java.lang.ClassLoader enclosingClassLoader, boolean defaultExcludes)
enclosingClassLoader
- the ClassLoader to decoratedefaultExcludes
- whether to apply DEFAULT_EXCLUDED_PACKAGES
public void addTransformer(java.lang.instrument.ClassFileTransformer transformer)
transformer
- the ClassFileTransformerpublic void copyTransformers(ShadowingClassLoader other)
other
- the ClassLoader to copy frompublic java.lang.Class<?> loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
java.lang.ClassNotFoundException
protected boolean isEligibleForShadowing(java.lang.String className)
className
- the class name to checkDecoratingClassLoader.isExcluded(java.lang.String)
public java.net.URL getResource(java.lang.String name)
getResource
in class java.lang.ClassLoader
@Nullable public java.io.InputStream getResourceAsStream(java.lang.String name)
getResourceAsStream
in class java.lang.ClassLoader
public java.util.Enumeration<java.net.URL> getResources(java.lang.String name) throws java.io.IOException
getResources
in class java.lang.ClassLoader
java.io.IOException