Package org.jrd.agent
Class Transformer
- java.lang.Object
-
- org.jrd.agent.Transformer
-
- All Implemented Interfaces:
ClassFileTransformer
public class Transformer extends Object implements ClassFileTransformer
This class represent our transformer for retrieving bytecode.- Author:
- pmikova
-
-
Constructor Summary
Constructors Constructor Description Transformer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allowToSaveBytecode()
This method allows saving of bytecodevoid
denyToSaveBytecode()
This method denies the bytecode to be saved during transformation.byte[]
getResult(String name)
Returns bytecode of transformed class.void
resetLastValidResult()
Resets the map with results to empty mapvoid
resetOverrides()
void
setOverride(String name, byte[] body)
byte[]
transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.instrument.ClassFileTransformer
transform
-
-
-
-
Method Detail
-
transform
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException
- Specified by:
transform
in interfaceClassFileTransformer
- Throws:
IllegalClassFormatException
-
getResult
public byte[] getResult(String name)
Returns bytecode of transformed class.- Parameters:
name
- name of class we want to get- Returns:
- bytes of given class
-
setOverride
public void setOverride(String name, byte[] body)
-
resetLastValidResult
public void resetLastValidResult()
Resets the map with results to empty map
-
resetOverrides
public void resetOverrides()
-
allowToSaveBytecode
public void allowToSaveBytecode()
This method allows saving of bytecode
-
denyToSaveBytecode
public void denyToSaveBytecode()
This method denies the bytecode to be saved during transformation.
-
-