public class ShadowingClassLoader extends DecoratingClassLoader
addTransformer(java.lang.instrument.ClassFileTransformer)
,
OverridingClassLoader
Modifier and Type | Field and Description |
---|---|
static String[] |
DEFAULT_EXCLUDED_PACKAGES
Packages that are excluded by default
|
parallelCapableClassLoaderAvailable
Constructor and Description |
---|
ShadowingClassLoader(ClassLoader enclosingClassLoader)
Create a new ShadowingClassLoader, decorating the given ClassLoader,
applying
DEFAULT_EXCLUDED_PACKAGES . |
ShadowingClassLoader(ClassLoader enclosingClassLoader,
boolean defaultExcludes)
Create a new ShadowingClassLoader, decorating the given ClassLoader.
|
Modifier and Type | Method and Description |
---|---|
void |
addTransformer(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.
|
URL |
getResource(String name) |
InputStream |
getResourceAsStream(String name) |
Enumeration<URL> |
getResources(String name) |
protected boolean |
isEligibleForShadowing(String className)
Determine whether the specified class is eligible for shadowing
by this class loader.
|
Class<?> |
loadClass(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 String[] DEFAULT_EXCLUDED_PACKAGES
public ShadowingClassLoader(ClassLoader enclosingClassLoader)
DEFAULT_EXCLUDED_PACKAGES
.enclosingClassLoader
- the ClassLoader to decorateShadowingClassLoader(ClassLoader, boolean)
public ShadowingClassLoader(ClassLoader enclosingClassLoader, boolean defaultExcludes)
enclosingClassLoader
- the ClassLoader to decoratedefaultExcludes
- whether to apply DEFAULT_EXCLUDED_PACKAGES
public void addTransformer(ClassFileTransformer transformer)
transformer
- the ClassFileTransformerpublic void copyTransformers(ShadowingClassLoader other)
other
- the ClassLoader to copy frompublic Class<?> loadClass(String name) throws ClassNotFoundException
loadClass
in class ClassLoader
ClassNotFoundException
protected boolean isEligibleForShadowing(String className)
className
- the class name to checkDecoratingClassLoader.isExcluded(java.lang.String)
public URL getResource(String name)
getResource
in class ClassLoader
public InputStream getResourceAsStream(String name)
getResourceAsStream
in class ClassLoader
public Enumeration<URL> getResources(String name) throws IOException
getResources
in class ClassLoader
IOException