|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.ClassLoader org.springframework.core.DecoratingClassLoader org.springframework.instrument.classloading.ShadowingClassLoader
public class ShadowingClassLoader
ClassLoader decorator that shadows an enclosing ClassLoader, applying registered transformers to all affected classes.
addTransformer(java.lang.instrument.ClassFileTransformer)
,
OverridingClassLoader
Field Summary | |
---|---|
private java.util.Map<java.lang.String,java.lang.Class> |
classCache
|
private java.util.List<java.lang.instrument.ClassFileTransformer> |
classFileTransformers
|
static java.lang.String[] |
DEFAULT_EXCLUDED_PACKAGES
Packages that are excluded by default |
private java.lang.ClassLoader |
enclosingClassLoader
|
Constructor Summary | |
---|---|
ShadowingClassLoader(java.lang.ClassLoader enclosingClassLoader)
Create a new ShadowingClassLoader, decorating the given ClassLoader. |
Method Summary | |
---|---|
void |
addTransformer(java.lang.instrument.ClassFileTransformer transformer)
Add the given ClassFileTransformer to the list of transformers that this ClassLoader will apply. |
private byte[] |
applyTransformers(java.lang.String name,
byte[] bytes)
|
void |
copyTransformers(ShadowingClassLoader other)
Copy all ClassFileTransformers from the given ClassLoader to the list of transformers that this ClassLoader will apply. |
private java.lang.Class |
doLoadClass(java.lang.String name)
|
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)
|
private boolean |
shouldShadow(java.lang.String className)
Determine whether the given class should be excluded from shadowing. |
Methods inherited from class org.springframework.core.DecoratingClassLoader |
---|
excludeClass, excludePackage, isExcluded |
Methods inherited from class java.lang.ClassLoader |
---|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String[] DEFAULT_EXCLUDED_PACKAGES
private final java.lang.ClassLoader enclosingClassLoader
private final java.util.List<java.lang.instrument.ClassFileTransformer> classFileTransformers
private final java.util.Map<java.lang.String,java.lang.Class> classCache
Constructor Detail |
---|
public ShadowingClassLoader(java.lang.ClassLoader enclosingClassLoader)
enclosingClassLoader
- the ClassLoader to decorateMethod Detail |
---|
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
private boolean shouldShadow(java.lang.String className)
className
- the name of the class
protected boolean isEligibleForShadowing(java.lang.String className)
className
- the class name to check
DecoratingClassLoader.isExcluded(java.lang.String)
private java.lang.Class doLoadClass(java.lang.String name) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
private byte[] applyTransformers(java.lang.String name, byte[] bytes)
public java.net.URL getResource(java.lang.String name)
getResource
in class java.lang.ClassLoader
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |