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 application classes are temporarily loaded in the overriding
ClassLoader for introspection purposes before eventually loading an
instrumented version of the class in the given parent ClassLoader.
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| public static final String[] | DEFAULT_EXCLUDED_PACKAGES
Packages that are excluded by default. |
| private final ClassLoader |
| Access | Constructor and Description |
|---|---|
| public | OverridingClassLoader(ClassLoader
the ClassLoader to build an overriding ClassLoader for parent)Create a new OverridingClassLoader for the given ClassLoader. |
| public | OverridingClassLoader(ClassLoader
the ClassLoader to build an overriding ClassLoader for parent, ClassLoader the ClassLoader to delegate to for overriding overrideDelegate)Create a new OverridingClassLoader for the given ClassLoader. |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | Returns: whether the specified class is eligiblethe class name to check className)Determine whether the specified class is eligible for overriding by this class loader. |
| protected byte[] | Returns: the byte content (with transformers already applied), ornull if no class defined for that namethe name of the class name)Load the defining bytes for the given class,
to be turned into a Class object through a |
| public Class | loadClass(String
The binary name of the class name)Overrides java. |
| protected Class | loadClass(String
The binary name of the class name, boolean If resolve)true then resolve the classOverrides java. |
| protected Class | Returns: the Class object, ornull if no class defined for that namethe name of the class name)Load the specified class for overriding purposes in this ClassLoader. |
| protected InputStream | Returns: the InputStream containing the byte code for the specified classthe name of the class name)Open an InputStream for the specified class. |
| protected byte[] | Returns: the transformed bytes (nevernull;
same as the input bytes if the transformation produced no changes)the fully-qualified name of the class being transformed name, byte[] the raw bytes of the class bytes)Transformation hook to be implemented by subclasses. |
| CLASS_FILE_SUFFIX | back to summary |
|---|---|
| private static final String CLASS_FILE_SUFFIX | |
| DEFAULT_EXCLUDED_PACKAGES | back to summary |
|---|---|
| public static final String[] DEFAULT_EXCLUDED_PACKAGES Packages that are excluded by default. | |
| overrideDelegate | back to summary |
|---|---|
| private final ClassLoader overrideDelegate
| |
| OverridingClassLoader | back to summary |
|---|---|
| public OverridingClassLoader(ClassLoader parent) Create a new OverridingClassLoader for the given ClassLoader.
| |
| OverridingClassLoader | back to summary |
|---|---|
| public OverridingClassLoader(ClassLoader parent, ClassLoader overrideDelegate) Create a new OverridingClassLoader for the given ClassLoader.
| |
| isEligibleForOverriding | back to summary |
|---|---|
| protected boolean isEligibleForOverriding(String className) Determine whether the specified class is eligible for overriding by this class loader.
| |
| loadBytesForClass | back to summary |
|---|---|
| protected byte[] loadBytesForClass(String name) throws ClassNotFoundException Load the defining bytes for the given class,
to be turned into a Class object through a The default implementation delegates to
| |
| loadClass | back to summary |
|---|---|
| public Class Overrides java. Doc from java. Loads the class with the specified binary name.
This method searches for classes in the same manner as the
| |
| loadClass | back to summary |
|---|---|
| protected Class Overrides java. Doc from java. Loads the class with the specified binary name. The default implementation of this method searches for classes in the following order:
If the class was found using the above steps, and the
Subclasses of Unless overridden, this method synchronizes on the result of
| |
| loadClassForOverriding | back to summary |
|---|---|
| protected Class Load the specified class for overriding purposes in this ClassLoader. The default implementation delegates to
| |
| openStreamForClass | back to summary |
|---|---|
| protected InputStream openStreamForClass(String name) Open an InputStream for the specified class. The default implementation loads a standard class file through
the parent ClassLoader's
| |
| transformIfNecessary | back to summary |
|---|---|
| protected byte[] transformIfNecessary(String name, byte[] bytes) Transformation hook to be implemented by subclasses. The default implementation simply returns the given bytes as-is.
| |