spring-framework / org.springframework.instrument.classloading / WeavingTransformer

WeavingTransformer

open class WeavingTransformer

ClassFileTransformer-based weaver, allowing for a list of transformers to be applied on a class byte array. Normally used inside class loaders.

Note: This class is deliberately implemented for minimal external dependencies, since it is included in weaver jars (to be deployed into application servers).

Author
Rod Johnson

Author
Costin Leau

Author
Juergen Hoeller

Since
2.0

Constructors

<init>

WeavingTransformer(classLoader: ClassLoader)

Create a new WeavingTransformer for the given class loader.

Functions

addTransformer

open fun addTransformer(transformer: ClassFileTransformer): Unit

Add a class file transformer to be applied by this weaver.

transformIfNecessary

open fun transformIfNecessary(className: String, bytes: ByteArray): ByteArray
open fun transformIfNecessary(className: String, internalName: String, bytes: ByteArray, pd: ProtectionDomain): ByteArray

Apply transformation on a given class byte definition. The method will always return a non-null byte array (if no transformation has taken place the array content will be identical to the original one).