org.bsf.smartValueObject.tools
Class ASMInstrumentor

java.lang.Object
  |
  +--org.bsf.smartValueObject.tools.ASMInstrumentor
All Implemented Interfaces:
Instrumentor

public class ASMInstrumentor
extends java.lang.Object
implements Instrumentor

ASM specific implementation of Instrumentor. This code is ugly (mainly due to ASM's low-levelness).

See Also:
Instrumentor, JavaAssistInstrumentor, ASM homepage

Nested Class Summary
private static class ASMInstrumentor.MyMethod
          Representation of a method.
private  class ASMInstrumentor.SVOClassAdapter
          Adapter to change class informations with ASM.
private  class ASMInstrumentor.SVOCodeAdapter
          Adapter to change the bytecode with ASM.
 
Nested classes inherited from class org.bsf.smartValueObject.tools.Instrumentor
Instrumentor.SmartReplacements
 
Field Summary
private  java.lang.String className
           
private  org.objectweb.asm.ClassWriter cw
           
private static org.apache.commons.logging.Log log
           
 
Fields inherited from interface org.bsf.smartValueObject.tools.Instrumentor
CLEANMETHOD, CREATEDMETHOD, CREATEMETHOD, DELETEDMETHOD, DELETEMETHOD, DIRTYMETHOD, SMARTCOLLECTION, SMARTCONTAINERS, SMARTLIST, SMARTMAP, SMARTSET, VERSIONCLASS, VERSIONFIELD, VERSIONHELPER, VERSIONINTERFACE, VERSIONMETHOD
 
Constructor Summary
ASMInstrumentor()
           
 
Method Summary
 java.lang.Class defineClass()
          Use internal classloader to build class object.
 byte[] getBytecode()
          Get modified class as byte array.
 void modifyClass(java.lang.String name)
          Modifies this class.
 void modifyClass(java.lang.String basedir, java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

cw

private org.objectweb.asm.ClassWriter cw

className

private java.lang.String className
Constructor Detail

ASMInstrumentor

public ASMInstrumentor()
Method Detail

modifyClass

public void modifyClass(java.lang.String name)
                 throws InstrumentorException
Description copied from interface: Instrumentor
Modifies this class.

Specified by:
modifyClass in interface Instrumentor
Parameters:
name - class to modify, package notation or filename.
Throws:
InstrumentorException - in case of errors

modifyClass

public void modifyClass(java.lang.String basedir,
                        java.lang.String name)
                 throws InstrumentorException
Specified by:
modifyClass in interface Instrumentor
InstrumentorException

getBytecode

public byte[] getBytecode()
                   throws InstrumentorException
Description copied from interface: Instrumentor
Get modified class as byte array.

Specified by:
getBytecode in interface Instrumentor
Returns:
versionable class as bytecode.
Throws:
InstrumentorException

defineClass

public java.lang.Class defineClass()
Description copied from interface: Instrumentor
Use internal classloader to build class object.

Exists rather for testing purposes, as classes won't be compatible !

Specified by:
defineClass in interface Instrumentor
Returns:
Versionable class.