public class WeavingTransformer extends Object
Note: This class is deliberately implemented for minimal external dependencies, since it is included in weaver jars (to be deployed into application servers).
Constructor and Description |
---|
WeavingTransformer(ClassLoader classLoader)
Create a new WeavingTransformer for the given class loader.
|
Modifier and Type | Method and Description |
---|---|
void |
addTransformer(ClassFileTransformer transformer)
Add a class file transformer to be applied by this weaver.
|
byte[] |
transformIfNecessary(String className,
byte[] bytes)
Apply transformation on a given class byte definition.
|
byte[] |
transformIfNecessary(String className,
String internalName,
byte[] bytes,
ProtectionDomain pd)
Apply transformation on a given class byte definition.
|
public WeavingTransformer(@Nullable ClassLoader classLoader)
classLoader
- the ClassLoader to build a transformer forpublic void addTransformer(ClassFileTransformer transformer)
transformer
- the class file transformer to registerpublic byte[] transformIfNecessary(String className, byte[] bytes)
className
- the full qualified name of the class in dot format (i.e. some.package.SomeClass)bytes
- class byte definitionpublic byte[] transformIfNecessary(String className, String internalName, byte[] bytes, @Nullable ProtectionDomain pd)
className
- the full qualified name of the class in dot format (i.e. some.package.SomeClass)internalName
- class name internal name in / format (i.e. some/package/SomeClass)bytes
- class byte definitionpd
- protection domain to be used (can be null)