com.objectwave.classFile
Class ChangeClass

java.lang.Object
  |
  +--com.objectwave.classFile.ChangeClass

public class ChangeClass
extends java.lang.Object

A class that allows the manipulation of byte codes.

Author:
Dave Hoag

Constructor Summary
ChangeClass()
           
 
Method Summary
 void addSimpleAttribute(ClassFile one)
           
 void copyConstantPoolFromOneToOther(ClassFile one, ClassFile other)
           
 ConstantPoolInfo createConstantPoolToCallMethod(java.lang.Class c, java.lang.String methodName, java.lang.Class[] args)
          Use this to create all the ConstantPoolInfo object necessary for a call to the specified method.
 void genericCopy(ClassFile one, ClassFile other)
          Copy all of the constants from on class to another.
protected  java.lang.String getArgsClassName(java.lang.Class c)
           
 void injectMethodInto(ClassFile one, ClassFile other, int idxOfMethod)
           
 void injectTrace(ClassFile one)
           
 void injectTrace(ClassFile one, java.lang.Class receiver, java.lang.String methodName, java.lang.Class[] args)
          Force a call to 'Tracker.trace'.
protected  boolean isPrimitiveConstant(ConstantPoolInfo item)
          case FIELDREF: case METHODREF: case INTERFACE: case NAMEANDTYPE: dos.writeShort(indexOf(arg1, pool)); dos.writeShort(indexOf(arg2, pool));
static void main(java.lang.String[] args)
           
protected  ConstantPoolInfo recursiveAdd(ClassFile one, ConstantPoolInfo cpi)
          Use recursion to ensure that ConstantPoolInfo dependecies are met.
 void updateGotos(byte[] data, int len, int adjust)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeClass

public ChangeClass()
Method Detail

main

public static void main(java.lang.String[] args)

injectTrace

public void injectTrace(ClassFile one)
                 throws java.lang.Exception
java.lang.Exception

injectTrace

public void injectTrace(ClassFile one,
                        java.lang.Class receiver,
                        java.lang.String methodName,
                        java.lang.Class[] args)
                 throws java.lang.Exception
Force a call to 'Tracker.trace'.

java.lang.Exception

updateGotos

public void updateGotos(byte[] data,
                        int len,
                        int adjust)

addSimpleAttribute

public void addSimpleAttribute(ClassFile one)
                        throws java.lang.Exception
java.lang.Exception

injectMethodInto

public void injectMethodInto(ClassFile one,
                             ClassFile other,
                             int idxOfMethod)
                      throws java.lang.Exception
java.lang.Exception

genericCopy

public void genericCopy(ClassFile one,
                        ClassFile other)
                 throws java.lang.Exception
Copy all of the constants from on class to another.

java.lang.Exception

recursiveAdd

protected ConstantPoolInfo recursiveAdd(ClassFile one,
                                        ConstantPoolInfo cpi)
                                 throws java.lang.Exception
Use recursion to ensure that ConstantPoolInfo dependecies are met.

java.lang.Exception

copyConstantPoolFromOneToOther

public void copyConstantPoolFromOneToOther(ClassFile one,
                                           ClassFile other)
                                    throws java.lang.Exception
java.lang.Exception

isPrimitiveConstant

protected boolean isPrimitiveConstant(ConstantPoolInfo item)
case FIELDREF: case METHODREF: case INTERFACE: case NAMEANDTYPE: dos.writeShort(indexOf(arg1, pool)); dos.writeShort(indexOf(arg2, pool));


createConstantPoolToCallMethod

public ConstantPoolInfo createConstantPoolToCallMethod(java.lang.Class c,
                                                       java.lang.String methodName,
                                                       java.lang.Class[] args)
                                                throws java.lang.NoSuchMethodException
Use this to create all the ConstantPoolInfo object necessary for a call to the specified method.

Returns:
ConstantPoolInfo of type METHODREF
java.lang.NoSuchMethodException

getArgsClassName

protected java.lang.String getArgsClassName(java.lang.Class c)