ej-technologies

org.gjt.jclasslib.structures
Class ConstantPoolUtil

java.lang.Object
  extended byorg.gjt.jclasslib.structures.ConstantPoolUtil

public class ConstantPoolUtil
extends Object

Utility methods for working on the constant pool of a ClassFile object.

Version:
$Revision: 1.6 $ $Date: 2003/08/18 07:52:54 $
Author:
Ingo Kegel

Method Summary
static int addConstantClassInfo(ClassFile classFile, String className, int sizeDelta)
          Add a ConstantClassInfo constant pool entry to the constant pool of a ClassFile.
static int addConstantFieldrefInfo(ClassFile classFile, String className, String fieldName, String fieldType, int sizeDelta)
          Add a ConstantFieldRef constant pool entry to the constant pool of a ClassFile.
static int addConstantMethodrefInfo(ClassFile classFile, String className, String methodName, String methodSignature, int sizeDelta)
          Add a ConstantMethodRef constant pool entry to the constant pool of a ClassFile.
static int addConstantNameAndTypeInfo(ClassFile classFile, String name, String descriptor, int sizeDelta)
          Add a ConstantNameAndTypeInfo constant pool entry to the constant pool of a ClassFile.
static int addConstantPoolEntry(ClassFile classFile, CPInfo newEntry, int sizeDelta)
          Add a constant pool entry to the constant pool of a ClassFile.
static int addConstantUTF8Info(ClassFile classFile, String string, int sizeDelta)
          Add a ConstantUTF8Info constant pool entry to the constant pool of a ClassFile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addConstantMethodrefInfo

public static int addConstantMethodrefInfo(ClassFile classFile,
                                           String className,
                                           String methodName,
                                           String methodSignature,
                                           int sizeDelta)
Add a ConstantMethodRef constant pool entry to the constant pool of a ClassFile.

Parameters:
classFile - the class file whose constant pool is to be edited
className - the name of the referenced class
methodName - the name of the referenced method
methodSignature - the signature of the referenced method
sizeDelta - the minimum increment by which the array holding the constant pool is to be enlarged. Set to 0 if unsure.
Returns:
the constant pool index of the added ConstantMethodRef

addConstantFieldrefInfo

public static int addConstantFieldrefInfo(ClassFile classFile,
                                          String className,
                                          String fieldName,
                                          String fieldType,
                                          int sizeDelta)
Add a ConstantFieldRef constant pool entry to the constant pool of a ClassFile.

Parameters:
classFile - the class file whose constant pool is to be edited
className - the name of the referenced class
fieldName - the name of the referenced field
fieldType - the type of the referenced field
sizeDelta - the minimum increment by which the array holding the constant pool is to be enlarged. Set to 0 if unsure.
Returns:
the constant pool index of the added ConstantMethodRef

addConstantNameAndTypeInfo

public static int addConstantNameAndTypeInfo(ClassFile classFile,
                                             String name,
                                             String descriptor,
                                             int sizeDelta)
Add a ConstantNameAndTypeInfo constant pool entry to the constant pool of a ClassFile.

Parameters:
classFile - the class file whose constant pool is to be edited
name - the name
descriptor - the descriptor
sizeDelta - the minimum increment by which the array holding the constant pool is to be enlarged. Set to 0 if unsure.
Returns:
the constant pool index of the added ConstantNameAndTypeInfo

addConstantClassInfo

public static int addConstantClassInfo(ClassFile classFile,
                                       String className,
                                       int sizeDelta)
Add a ConstantClassInfo constant pool entry to the constant pool of a ClassFile.

Parameters:
classFile - the class file whose constant pool is to be edited
className - the name of the referenced class
sizeDelta - the minimum increment by which the array holding the constant pool is to be enlarged. Set to 0 if unsure.
Returns:
the constant pool index of the added ConstantClassInfo

addConstantUTF8Info

public static int addConstantUTF8Info(ClassFile classFile,
                                      String string,
                                      int sizeDelta)
Add a ConstantUTF8Info constant pool entry to the constant pool of a ClassFile.

Parameters:
classFile - the class file whose constant pool is to be edited
string - the string
sizeDelta - the minimum increment by which the array holding the constant pool is to be enlarged. Set to 0 if unsure.
Returns:
the constant pool index of the added ConstantUTF8Info

addConstantPoolEntry

public static int addConstantPoolEntry(ClassFile classFile,
                                       CPInfo newEntry,
                                       int sizeDelta)
Add a constant pool entry to the constant pool of a ClassFile.

Parameters:
classFile - the class file whose constant pool is to be edited
newEntry - the new constant pool entry
sizeDelta - the minimum increment by which the array holding the constant pool is to be enlarged. Set to 0 if unsure.
Returns:
the constant pool index of the added constant pool entry

ej-technologies