Package com.avrix.agent
Class AgentTransformer
java.lang.Object
com.avrix.agent.AgentTransformer
- All Implemented Interfaces:
ClassFileTransformer
The class represents a class transformer, used to change classes at boot time.
It implements the
ClassFileTransformer
interface, which allows you to change the byte code of classes before they are loaded into the JVM.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
transform
(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) The transform method is called for each class that is loaded into the JVM.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.instrument.ClassFileTransformer
transform
-
Constructor Details
-
AgentTransformer
public AgentTransformer()
-
-
Method Details
-
transform
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException The transform method is called for each class that is loaded into the JVM. It takes the byte code of the original class and returns the modified byte code. This method implementation calls the getModifyClass method of theAgentManager
class to obtain the modified byte code of the class.- Specified by:
transform
in interfaceClassFileTransformer
- Parameters:
loader
- class of the loader that loads this classclassName
- full class name in class path format (delimited by '/')classBeingRedefined
- the class that is being overridden (can be null if the class is not being overridden)protectionDomain
- the protection domain in which the class runsclassfileBuffer
- byte code of the original class- Returns:
- the modified byte code of the class
- Throws:
IllegalClassFormatException
- if the class bytecode cannot be transformed
-