Package javassist.bytecode
Class ClassFileWriter.ConstPoolWriter
- java.lang.Object
-
- javassist.bytecode.ClassFileWriter.ConstPoolWriter
-
- Enclosing class:
- ClassFileWriter
public static final class ClassFileWriter.ConstPoolWriter extends Object
Constant Pool.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddClassInfo(int name)Adds a newCONSTANT_Class_infostructure.intaddClassInfo(String jvmname)Adds a newCONSTANT_Class_infostructure.int[]addClassInfo(String[] classNames)MakesCONSTANT_Class_infoobjects for each class name.intaddDoubleInfo(double d)Adds a newCONSTANT_Double_infostructure.intaddDynamicInfo(int bootstrap, int nameAndTypeInfo)Adds a newCONSTANT_Dynamic_infostructure.intaddFieldrefInfo(int classInfo, int nameAndTypeInfo)Adds a newCONSTANT_Fieldref_infostructure.intaddFloatInfo(float f)Adds a newCONSTANT_Float_infostructure.intaddIntegerInfo(int i)Adds a newCONSTANT_Integer_infostructure.intaddInterfaceMethodrefInfo(int classInfo, int nameAndTypeInfo)Adds a newCONSTANT_InterfaceMethodref_infostructure.intaddInvokeDynamicInfo(int bootstrap, int nameAndTypeInfo)Adds a newCONSTANT_InvokeDynamic_infostructure.intaddLongInfo(long l)Adds a newCONSTANT_Long_infostructure.intaddMethodHandleInfo(int kind, int index)Adds a newCONSTANT_MethodHandle_infostructure.intaddMethodrefInfo(int classInfo, int nameAndTypeInfo)Adds a newCONSTANT_Methodref_infostructure.intaddMethodTypeInfo(int desc)Adds a newCONSTANT_MethodType_infostructure.intaddNameAndTypeInfo(int name, int type)Adds a newCONSTANT_NameAndType_infostructure.intaddNameAndTypeInfo(String name, String type)Adds a newCONSTANT_NameAndType_infostructure.intaddStringInfo(String str)Adds a newCONSTANT_String_infostructure.intaddUtf8Info(String utf8)Adds a newCONSTANT_Utf8_infostructure.
-
-
-
Method Detail
-
addClassInfo
public int[] addClassInfo(String[] classNames)
MakesCONSTANT_Class_infoobjects for each class name.- Returns:
- an array of indexes indicating
CONSTANT_Class_infos.
-
addClassInfo
public int addClassInfo(String jvmname)
Adds a newCONSTANT_Class_infostructure.This also adds a
CONSTANT_Utf8_infostructure for storing the class name.- Parameters:
jvmname- the JVM-internal representation of a class name. e.g.java/lang/Object.- Returns:
- the index of the added entry.
-
addClassInfo
public int addClassInfo(int name)
Adds a newCONSTANT_Class_infostructure.- Parameters:
name-name_index- Returns:
- the index of the added entry.
-
addNameAndTypeInfo
public int addNameAndTypeInfo(String name, String type)
Adds a newCONSTANT_NameAndType_infostructure.- Parameters:
name-name_indextype-descriptor_index- Returns:
- the index of the added entry.
-
addNameAndTypeInfo
public int addNameAndTypeInfo(int name, int type)Adds a newCONSTANT_NameAndType_infostructure.- Parameters:
name-name_indextype-descriptor_index- Returns:
- the index of the added entry.
-
addFieldrefInfo
public int addFieldrefInfo(int classInfo, int nameAndTypeInfo)Adds a newCONSTANT_Fieldref_infostructure.- Parameters:
classInfo-class_indexnameAndTypeInfo-name_and_type_index.- Returns:
- the index of the added entry.
-
addMethodrefInfo
public int addMethodrefInfo(int classInfo, int nameAndTypeInfo)Adds a newCONSTANT_Methodref_infostructure.- Parameters:
classInfo-class_indexnameAndTypeInfo-name_and_type_index.- Returns:
- the index of the added entry.
-
addInterfaceMethodrefInfo
public int addInterfaceMethodrefInfo(int classInfo, int nameAndTypeInfo)Adds a newCONSTANT_InterfaceMethodref_infostructure.- Parameters:
classInfo-class_indexnameAndTypeInfo-name_and_type_index.- Returns:
- the index of the added entry.
-
addMethodHandleInfo
public int addMethodHandleInfo(int kind, int index)Adds a newCONSTANT_MethodHandle_infostructure.- Parameters:
kind-reference_kindsuch as.REF_invokeStaticindex-reference_index.- Returns:
- the index of the added entry.
- Since:
- 3.17.1
-
addMethodTypeInfo
public int addMethodTypeInfo(int desc)
Adds a newCONSTANT_MethodType_infostructure.- Parameters:
desc-descriptor_index.- Returns:
- the index of the added entry.
- Since:
- 3.17.1
-
addInvokeDynamicInfo
public int addInvokeDynamicInfo(int bootstrap, int nameAndTypeInfo)Adds a newCONSTANT_InvokeDynamic_infostructure.- Parameters:
bootstrap-bootstrap_method_attr_index.nameAndTypeInfo-name_and_type_index.- Returns:
- the index of the added entry.
- Since:
- 3.17.1
-
addDynamicInfo
public int addDynamicInfo(int bootstrap, int nameAndTypeInfo)Adds a newCONSTANT_Dynamic_infostructure.- Parameters:
bootstrap-bootstrap_method_attr_index.nameAndTypeInfo-name_and_type_index.- Returns:
- the index of the added entry.
- Since:
- 3.26
-
addStringInfo
public int addStringInfo(String str)
Adds a newCONSTANT_String_infostructure.This also adds a new
CONSTANT_Utf8_infostructure.- Returns:
- the index of the added entry.
-
addIntegerInfo
public int addIntegerInfo(int i)
Adds a newCONSTANT_Integer_infostructure.- Returns:
- the index of the added entry.
-
addFloatInfo
public int addFloatInfo(float f)
Adds a newCONSTANT_Float_infostructure.- Returns:
- the index of the added entry.
-
addLongInfo
public int addLongInfo(long l)
Adds a newCONSTANT_Long_infostructure.- Returns:
- the index of the added entry.
-
addDoubleInfo
public int addDoubleInfo(double d)
Adds a newCONSTANT_Double_infostructure.- Returns:
- the index of the added entry.
-
addUtf8Info
public int addUtf8Info(String utf8)
Adds a newCONSTANT_Utf8_infostructure.- Returns:
- the index of the added entry.
-
-