|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.janetfilter.core.plugin;
|
|
|
|
|
|
|
|
|
|
import java.security.ProtectionDomain;
|
|
|
|
|
|
|
|
|
|
public interface MyTransformer {
|
|
|
|
|
/**
|
|
|
|
|
* @return class name like this: package/to/className, null means it's a global transformer
|
|
|
|
@ -30,6 +32,13 @@ public interface MyTransformer {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* for global transformers only
|
|
|
|
|
*/
|
|
|
|
|
default void before(ClassLoader loader, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, String className, byte[] classBytes) throws Exception {
|
|
|
|
|
before(className, classBytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* for global transformers only
|
|
|
|
|
*/
|
|
|
|
@ -37,6 +46,13 @@ public interface MyTransformer {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* for global transformers only
|
|
|
|
|
*/
|
|
|
|
|
default byte[] preTransform(ClassLoader loader, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, String className, byte[] classBytes, int order) throws Exception {
|
|
|
|
|
return preTransform(className, classBytes, order);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* for global transformers only
|
|
|
|
|
*/
|
|
|
|
@ -44,6 +60,13 @@ public interface MyTransformer {
|
|
|
|
|
return transform(className, classBytes, order); // for old version
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* for normal transformers only
|
|
|
|
|
*/
|
|
|
|
|
default byte[] transform(ClassLoader loader, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, String className, byte[] classBytes, int order) throws Exception {
|
|
|
|
|
return transform(className, classBytes, order);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* for normal transformers only
|
|
|
|
|
*/
|
|
|
|
@ -51,6 +74,13 @@ public interface MyTransformer {
|
|
|
|
|
return classBytes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* for global transformers only
|
|
|
|
|
*/
|
|
|
|
|
default byte[] postTransform(ClassLoader loader, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, String className, byte[] classBytes, int order) throws Exception {
|
|
|
|
|
return postTransform(className, classBytes, order);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* for global transformers only
|
|
|
|
|
*/
|
|
|
|
@ -58,6 +88,13 @@ public interface MyTransformer {
|
|
|
|
|
return classBytes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* for global transformers only
|
|
|
|
|
*/
|
|
|
|
|
default void after(ClassLoader loader, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, String className, byte[] classBytes) throws Exception {
|
|
|
|
|
after(className, classBytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* for global transformers only
|
|
|
|
|
*/
|
|
|
|
|