Package org.springframework.instrument.classloading

# Class SimpleInstrumentableClassLoader

java.lang.Object
java.lang.ClassLoader
org.springframework.core.DecoratingClassLoader
org.springframework.core.OverridingClassLoader
org.springframework.instrument.classloading.SimpleInstrumentableClassLoader

public class SimpleInstrumentableClassLoader extends org.springframework.core.OverridingClassLoader
Simplistic implementation of an instrumentable `ClassLoader`.

Usable in tests and standalone environments.

Since:
  2.0
Author:
  Rod Johnson, Costin Leau

## Field Summary

### Fields inherited from class org.springframework.core.OverridingClassLoader

`DEFAULT_EXCLUDED_PACKAGES`

## Constructor Summary

Constructors
Constructor
Description
`SimpleInstrumentableClassLoader(ClassLoader parent)`
Create a new SimpleInstrumentableClassLoader for the given ClassLoader.

## Method Summary

Modifier and Type
Method
Description
`void`
`addTransformer(ClassFileTransformer transformer)`
Add a `ClassFileTransformer` to be applied by this ClassLoader.
`protected byte[]`
`transformIfNecessary(String name, byte[] bytes)`

### Methods inherited from class org.springframework.core.OverridingClassLoader

`isEligibleForOverriding, loadBytesForClass, loadClass, loadClass, loadClassForOverriding, openStreamForClass`

### 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, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SimpleInstrumentableClassLoader

public SimpleInstrumentableClassLoader(@Nullable ClassLoader parent)
Create a new SimpleInstrumentableClassLoader for the given ClassLoader.

Parameters:
  `parent` - the ClassLoader to build an instrumentable ClassLoader for

## Method Details

### addTransformer

public void addTransformer(ClassFileTransformer transformer)
Add a `ClassFileTransformer` to be applied by this ClassLoader.

Parameters:
  `transformer` - the `ClassFileTransformer` to register

### transformIfNecessary

protected byte[] transformIfNecessary(String name, byte[] bytes)

Overrides:
  `transformIfNecessary` in class `org.springframework.core.OverridingClassLoader`