|
The Spring Framework | |||||||||
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.OverridingClassLoader
public class OverridingClassLoader
ClassLoader
that does not always delegate to the
parent loader, as normal class loaders do. This enables, for example,
instrumentation to be forced in the overriding ClassLoader, or a
"throwaway" class loading behavior, where selected classes are
temporarily loaded in the overriding ClassLoader, in order to be load
an instrumented version of the class in the parent ClassLoader later on.
Constructor Summary | |
---|---|
OverridingClassLoader(ClassLoader parent)
Create a new OverridingClassLoader for the given class loader. |
Method Summary | |
---|---|
void |
excludeClass(String className)
Add a class name to exclude from overriding. |
void |
excludePackage(String packageName)
Add a package name to exclude from overriding. |
protected boolean |
isEligibleForOverriding(String className)
Determine whether the specified class is eligible for overriding by this class loader. |
protected Class |
loadClass(String name,
boolean resolve)
|
protected byte[] |
transformIfNecessary(String name,
byte[] bytes)
Transformation hook to be implemented by subclasses. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OverridingClassLoader(ClassLoader parent)
parent
- the ClassLoader to build an overriding ClassLoader forMethod Detail |
---|
public void excludePackage(String packageName)
Any class whose fully-qualified name starts with the name registered here will be handled by the parent ClassLoader in the usual fashion.
packageName
- the package name to excludepublic void excludeClass(String className)
Any class name registered here will be handled by the parent ClassLoader in the usual fashion.
className
- the class name to excludeprotected Class loadClass(String name, boolean resolve) throws ClassNotFoundException
loadClass
in class ClassLoader
ClassNotFoundException
protected boolean isEligibleForOverriding(String className)
The default implementation checks against excluded packages and classes.
className
- the class name to check
excludePackage(java.lang.String)
,
excludeClass(java.lang.String)
protected byte[] transformIfNecessary(String name, byte[] bytes)
The default implementation simply returns the given bytes as-is.
name
- the fully-qualified name of the class being transformedbytes
- the raw bytes of the class
null
;
same as the input bytes if the transformation produced no changes)
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |