Interface ResettableClassFileTransformer.WithDelegation.Callback<T>

  • Type Parameters:
    T - The type of the value that is passed between the callback methods.
    Enclosing class:
    ResettableClassFileTransformer.WithDelegation

    public static interface ResettableClassFileTransformer.WithDelegation.Callback<T>
    A callback that is invoked upon class file transformation.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void onAfterTransform​(T value, JavaModule module, java.lang.ClassLoader classLoader, java.lang.String internalName, java.lang.Class<?> classBeingRedefined, java.security.ProtectionDomain protectionDomain, byte[] binaryRepresentation)
      Invoked after the transformation is applied.
      T onBeforeTransform​(JavaModule module, java.lang.ClassLoader classLoader, java.lang.String internalName, java.lang.Class<?> classBeingRedefined, java.security.ProtectionDomain protectionDomain, byte[] binaryRepresentation)
      Invoked before the transformation is applied.
    • Method Detail

      • onBeforeTransform

        @MaybeNull
        T onBeforeTransform​(@MaybeNull
                            JavaModule module,
                            @MaybeNull
                            java.lang.ClassLoader classLoader,
                            @MaybeNull
                            java.lang.String internalName,
                            @MaybeNull
                            java.lang.Class<?> classBeingRedefined,
                            @MaybeNull
                            java.security.ProtectionDomain protectionDomain,
                            byte[] binaryRepresentation)
                     throws java.lang.instrument.IllegalClassFormatException
        Invoked before the transformation is applied.
        Parameters:
        module - The instrumented class's Java module or null if the module system is not supported.
        classLoader - The type's class loader or null if the type is loaded by the bootstrap loader.
        internalName - The internal name of the instrumented class.
        classBeingRedefined - The loaded Class being redefined or null if no such class exists.
        protectionDomain - The instrumented type's protection domain or null if not available.
        binaryRepresentation - The class file of the instrumented class in its current state.
        Returns:
        A value to pass to the method that is invoked after transformation or null.
        Throws:
        java.lang.instrument.IllegalClassFormatException - If the class file was found invalid.
      • onAfterTransform

        void onAfterTransform​(@MaybeNull
                              T value,
                              @MaybeNull
                              JavaModule module,
                              @MaybeNull
                              java.lang.ClassLoader classLoader,
                              @MaybeNull
                              java.lang.String internalName,
                              @MaybeNull
                              java.lang.Class<?> classBeingRedefined,
                              @MaybeNull
                              java.security.ProtectionDomain protectionDomain,
                              byte[] binaryRepresentation)
                       throws java.lang.instrument.IllegalClassFormatException
        Invoked after the transformation is applied.
        Parameters:
        value - The value that was returned before transformation.
        module - The instrumented class's Java module or null if the module system is not supported.
        classLoader - The type's class loader or null if the type is loaded by the bootstrap loader.
        internalName - The internal name of the instrumented class.
        classBeingRedefined - The loaded Class being redefined or null if no such class exists.
        protectionDomain - The instrumented type's protection domain or null if not available.
        binaryRepresentation - The class file of the instrumented class in its current state.
        Throws:
        java.lang.instrument.IllegalClassFormatException - If the class file was found invalid.