org.springframework.instrument.classloading

## 类 WeavingTransformer

- java.lang.Object
- - org.springframework.instrument.classloading.WeavingTransformer

-     public class WeavingTransformer
      extends Object

  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).

  从以下版本开始:
    2.0
  作者:
    Rod Johnson, Costin Leau, Juergen Hoeller

- - ### 构造器概要

    构造器
    构造器和说明
    `WeavingTransformer(ClassLoader classLoader)` Create a new WeavingTransformer for the given class loader.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `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.

    - ### 从类继承的方法 java.lang.Object

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

- - ### 构造器详细资料

    - #### WeavingTransformer

          public WeavingTransformer(@Nullable
                                    ClassLoader classLoader)

      Create a new WeavingTransformer for the given class loader.
      参数:
        `classLoader` - the ClassLoader to build a transformer for

  - ### 方法详细资料

    - #### addTransformer

          public void addTransformer(ClassFileTransformer transformer)

      Add a class file transformer to be applied by this weaver.
      参数:
        `transformer` - the class file transformer to register

    - #### transformIfNecessary

          public byte[] transformIfNecessary(String className,
                                             byte[] bytes)

      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 definition
        `pd` - protection domain to be used (can be null)
      返回:
        (possibly transformed) class byte definition