类 WeavingTransformer
java.lang.Object
cn.taketoday.instrument.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).
- 从以下版本开始:
- 4.0
- 作者:
- Rod Johnson, Costin Leau, Juergen Hoeller
-
构造器概要
构造器构造器说明WeavingTransformer(ClassLoader classLoader) Create a new WeavingTransformer for the given class loader. -
方法概要
修饰符和类型方法说明voidaddTransformer(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.
-
构造器详细资料
-
WeavingTransformer
Create a new WeavingTransformer for the given class loader.- 参数:
classLoader- the ClassLoader to build a transformer for
-
-
方法详细资料
-
addTransformer
Add a class file transformer to be applied by this weaver.- 参数:
transformer- the class file transformer to register
-
transformIfNecessary
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).- 参数:
className- the full qualified name of the class in dot format (i.e. some.package.SomeClass)bytes- class byte definition- 返回:
- (possibly transformed) class byte definition
-
transformIfNecessary
public byte[] transformIfNecessary(String className, String internalName, byte[] bytes, @Nullable ProtectionDomain pd) 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).- 参数:
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)- 返回:
- (possibly transformed) class byte definition
-