|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.sf.cglib.CodeGenerator
Abstract base class for code generators
| Inner Class Summary | |
protected static interface |
CodeGenerator.ProcessArrayCallback
|
| Field Summary | |
protected boolean |
debug
|
| Fields inherited from interface net.sf.cglib.Constants |
TYPE_OBJECT, TYPES_EMPTY, TYPES_OBJECT, TYPES_OBJECT_ARRAY, TYPES_STRING, TYPES_THROWABLE |
| Fields inherited from interface org.apache.bcel.Constants |
AALOAD, AASTORE, ACC_ABSTRACT, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_SYNCHRONIZED, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_TRANSIENT, ACC_VOLATILE, ACCESS_NAMES, ACONST_NULL, ALOAD, ALOAD_0, ALOAD_1, ALOAD_2, ALOAD_3, ANEWARRAY, ANEWARRAY_QUICK, ARETURN, ARRAYLENGTH, ASTORE, ASTORE_0, ASTORE_1, ASTORE_2, ASTORE_3, ATHROW, ATTR_CODE, ATTR_CONSTANT_VALUE, ATTR_DEPRECATED, ATTR_EXCEPTIONS, ATTR_INNER_CLASSES, ATTR_LINE_NUMBER_TABLE, ATTR_LOCAL_VARIABLE_TABLE, ATTR_PMG, ATTR_SIGNATURE, ATTR_SYNTHETIC, ATTR_SOURCE_FILE, ATTR_STACK_MAP, ATTR_UNKNOWN, ATTRIBUTE_NAMES, BALOAD, BASTORE, BIPUSH, BREAKPOINT, CALOAD, CASTORE, CHECKCAST, CHECKCAST_QUICK, CONSTANT_Class, CONSTANT_Double, CONSTANT_Fieldref, CONSTANT_Float, CONSTANT_Integer, CONSTANT_InterfaceMethodref, CONSTANT_Long, CONSTANT_Methodref, CONSTANT_NameAndType, CONSTANT_NAMES, CONSTANT_String, CONSTANT_Utf8, CONSTRUCTOR_NAME, CONSUME_STACK, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DLOAD_0, DLOAD_1, DLOAD_2, DLOAD_3, DMUL, DNEG, DREM, DRETURN, DSTORE, DSTORE_0, DSTORE_1, DSTORE_2, DSTORE_3, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAD_0, FLOAD_1, FLOAD_2, FLOAD_3, FMUL, FNEG, FREM, FRETURN, FSTORE, FSTORE_0, FSTORE_1, FSTORE_2, FSTORE_3, FSUB, GETFIELD, GETFIELD_QUICK, GETFIELD_QUICK_W, GETFIELD2_QUICK, GETSTATIC, GETSTATIC_QUICK, GETSTATIC2_QUICK, GOTO, GOTO_W, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILLEGAL_OPCODE, ILLEGAL_TYPE, ILOAD, ILOAD_0, ILOAD_1, ILOAD_2, ILOAD_3, IMPDEP1, IMPDEP2, IMUL, INEG, INSTANCEOF, INSTANCEOF_QUICK, INT2BYTE, INT2CHAR, INT2SHORT, INTERFACES_IMPLEMENTED_BY_ARRAYS, INVOKEINTERFACE, INVOKEINTERFACE_QUICK, INVOKENONVIRTUAL, INVOKENONVIRTUAL_QUICK, INVOKESPECIAL, INVOKESTATIC, INVOKESTATIC_QUICK, INVOKESUPER_QUICK, INVOKEVIRTUAL, INVOKEVIRTUAL_QUICK, INVOKEVIRTUAL_QUICK_W, INVOKEVIRTUALOBJECT_QUICK, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISTORE_0, ISTORE_1, ISTORE_2, ISTORE_3, ISUB, ITEM_Bogus, ITEM_Double, ITEM_Float, ITEM_InitObject, ITEM_Integer, ITEM_Long, ITEM_NAMES, ITEM_NewObject, ITEM_Null, ITEM_Object, IUSHR, IXOR, JSR, JSR_W, KNOWN_ATTRIBUTES, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDC_QUICK, LDC_W, LDC_W_QUICK, LDC2_W, LDC2_W_QUICK, LDIV, LLOAD, LLOAD_0, LLOAD_1, LLOAD_2, LLOAD_3, LMUL, LNEG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSTORE_0, LSTORE_1, LSTORE_2, LSTORE_3, LSUB, LUSHR, LXOR, MAJOR, MAJOR_1_1, MAJOR_1_2, MAJOR_1_3, MAX_ACC_FLAG, MAX_BYTE, MAX_CODE_SIZE, MAX_CP_ENTRIES, MAX_SHORT, MINOR, MINOR_1_1, MINOR_1_2, MINOR_1_3, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, MULTIANEWARRAY_QUICK, NEW, NEW_QUICK, NEWARRAY, NO_OF_OPERANDS, NOP, OPCODE_NAMES, POP, POP2, PRODUCE_STACK, PUSH, PUTFIELD, PUTFIELD_QUICK, PUTFIELD_QUICK_W, PUTFIELD2_QUICK, PUTSTATIC, PUTSTATIC_QUICK, PUTSTATIC2_QUICK, RESERVED, RET, RETURN, SALOAD, SASTORE, SHORT_TYPE_NAMES, SIPUSH, STATIC_INITIALIZER_NAME, SWAP, SWITCH, T_ADDRESS, T_ARRAY, T_BYTE, T_BOOLEAN, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_OBJECT, T_REFERENCE, T_SHORT, T_UNKNOWN, T_VOID, TABLESWITCH, TYPE_NAMES, TYPE_OF_OPERANDS, UNDEFINED, UNPREDICTABLE, WIDE |
| Constructor Summary | |
protected |
CodeGenerator(java.lang.String className,
java.lang.Class superclass,
java.lang.ClassLoader loader)
|
| Method Summary | |
protected void |
aaload()
|
protected void |
aaload(int index)
|
protected void |
aastore()
|
protected void |
aconst_null()
|
protected void |
array_load(java.lang.Class clazz)
|
protected void |
array_store(java.lang.Class clazz)
|
protected void |
arraylength()
|
protected void |
athrow()
|
protected void |
athrow(java.lang.String label)
|
protected void |
begin_constructor()
|
protected void |
begin_constructor(java.lang.Class[] parameterTypes)
|
protected void |
begin_constructor(java.lang.reflect.Constructor constructor)
|
protected int |
begin_handler()
|
protected void |
begin_method(int modifiers,
java.lang.Class returnType,
java.lang.String methodName,
java.lang.Class[] parameterTypes,
java.lang.Class[] exceptionTypes)
|
protected void |
begin_method(java.lang.reflect.Method method)
|
protected void |
begin_method(java.lang.reflect.Method method,
int modifiers)
|
protected void |
begin_static()
|
protected void |
box(java.lang.Class clazz)
If the argument is a primitive class, replaces the primitive value on the top of the stack with the wrapped (Object) equivalent. |
protected void |
checkcast_this()
|
protected void |
checkcast(java.lang.Class clazz)
|
protected void |
create_arg_array()
Allocates and fills an Object[] array with the arguments to the current method. |
protected void |
dcmpg()
|
protected void |
declare_field(int modifiers,
java.lang.Class typeClass,
java.lang.String name)
|
protected void |
declare_interface(java.lang.Class iface)
|
protected void |
declare_interfaces(java.lang.Class[] interfaces)
|
java.lang.Class |
define()
|
protected void |
dup_x1()
|
protected void |
dup_x2()
|
protected void |
dup()
|
protected void |
dup(java.lang.String label)
|
protected void |
dup2()
|
protected void |
end_constructor()
|
protected void |
end_handler()
|
protected void |
end_method()
|
protected void |
end_static()
|
protected void |
fcmpg()
|
protected abstract void |
generate()
method used to generate code |
protected void |
generateNullConstructor()
|
protected java.lang.String |
getClassName()
|
protected int |
getDefaultModifiers(java.lang.reflect.Method method)
|
protected void |
getfield(java.lang.reflect.Field field)
|
protected void |
getfield(java.lang.String name)
|
protected static java.lang.String |
getMethodSignature(java.lang.reflect.Method method)
|
protected void |
getstatic(java.lang.String name)
|
protected java.lang.Class |
getSuperclass()
|
static org.apache.bcel.generic.Type |
getType(java.lang.Class cl)
|
protected void |
goTo(java.lang.String label)
|
protected void |
handle_exception(int ref,
java.lang.Class exceptionType)
|
protected void |
iadd()
|
protected void |
if_icmpeq(java.lang.String label)
|
protected void |
if_icmplt(java.lang.String label)
|
protected void |
if_icmpne(java.lang.String label)
|
protected void |
ifeq(java.lang.String label)
|
protected void |
ifge(java.lang.String label)
|
protected void |
ifgt(java.lang.String label)
|
protected void |
ifle(java.lang.String label)
|
protected void |
iflt(java.lang.String label)
|
protected void |
ifne(java.lang.String label)
|
protected void |
ifnonnull(java.lang.String label)
|
protected void |
ifnull(java.lang.String label)
|
protected void |
iinc(java.lang.String local,
int amount)
|
protected void |
imul()
|
protected void |
instance_of_this()
|
protected void |
instance_of(java.lang.Class clazz)
|
protected void |
invoke_constructor_this()
|
protected void |
invoke_constructor_this(java.lang.Class[] parameterTypes)
|
protected void |
invoke_constructor(java.lang.Class type)
|
protected void |
invoke_constructor(java.lang.Class type,
java.lang.Class[] parameterTypes)
|
protected void |
invoke_static_this(java.lang.String methodName,
java.lang.Class returnType,
java.lang.Class[] parameterTypes)
|
protected void |
invoke_virtual_this(java.lang.String methodName,
java.lang.Class returnType,
java.lang.Class[] parameterTypes)
|
protected void |
invoke_virtual(java.lang.reflect.Method method)
|
protected void |
invoke(java.lang.reflect.Method method)
|
protected void |
ixor()
|
protected void |
jsr(java.lang.String label)
|
protected void |
l2i()
|
protected void |
lcmp()
|
protected void |
load_arg(int index)
Pushes the specified argument of the current method onto the stack. |
protected void |
load_args()
Pushes all of the arguments of the current method onto the stack. |
protected void |
load_args(int fromArg,
int count)
|
protected void |
load_class_this()
|
protected void |
load_class(java.lang.Class clazz)
|
protected void |
load_local(java.lang.String name)
|
protected void |
load_this()
|
protected void |
local_type(java.lang.String name,
java.lang.Class type)
|
protected void |
lushr()
|
protected void |
lxor()
|
protected void |
new_instance_this()
|
protected void |
new_instance(java.lang.Class clazz)
|
protected void |
newarray()
|
protected void |
newarray(java.lang.Class clazz)
|
protected java.lang.String |
newLabel()
|
protected java.lang.String |
newLocal()
|
protected void |
nop()
|
protected void |
nop(java.lang.String label)
|
protected void |
not_equals(java.lang.Class clazz,
java.lang.String notEquals)
Branches to the specified label if the top two items on the stack are not equal. |
protected void |
nullcmp(java.lang.String oneNull,
java.lang.String bothNull)
If both objects on the top of the stack are non-null, does nothing. |
protected void |
pop()
|
protected void |
pop(java.lang.String label)
|
protected void |
pop2()
|
protected void |
process_array(java.lang.Class type,
CodeGenerator.ProcessArrayCallback callback)
Process an array on the stack. |
protected void |
process_arrays(java.lang.Class clazz,
CodeGenerator.ProcessArrayCallback callback)
Process two arrays on the stack in parallel. |
protected void |
push_object(java.lang.Object obj)
|
protected void |
push(double value)
|
protected void |
push(float value)
|
protected void |
push(int i)
|
protected void |
push(long value)
|
protected void |
push(java.lang.Object[] array)
|
protected void |
push(java.lang.String value)
|
protected void |
putfield(java.lang.reflect.Field field)
|
protected void |
putfield(java.lang.String name)
|
protected void |
putstatic(java.lang.String name)
|
protected void |
return_value()
|
static void |
setDebugLocation(java.lang.String debugLocation)
|
protected void |
store_local(java.lang.String name)
|
protected void |
super_getfield(java.lang.String name)
|
protected void |
super_invoke_constructor()
|
protected void |
super_invoke_constructor(java.lang.Class[] parameterTypes)
|
protected void |
super_invoke_constructor(java.lang.reflect.Constructor constructor)
|
protected void |
super_invoke()
|
protected void |
super_invoke(java.lang.reflect.Method method)
|
protected void |
super_putfield(java.lang.String name)
|
protected void |
swap()
|
protected void |
swap(java.lang.String label)
|
protected void |
throwException(java.lang.Class type,
java.lang.String msg)
|
protected void |
unbox_or_zero(java.lang.Class type)
Unboxes the object on the top of the stack. |
protected void |
unbox(java.lang.Class clazz)
If the argument is a primitive class, replaces the object on the top of the stack with the unwrapped (primitive) equivalent. |
protected void |
zero_or_null(java.lang.Class type)
Pushes a zero onto the stack if the argument is a primitive class, or a null otherwise. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean debug
| Constructor Detail |
protected CodeGenerator(java.lang.String className,
java.lang.Class superclass,
java.lang.ClassLoader loader)
| Method Detail |
protected java.lang.String getClassName()
protected java.lang.Class getSuperclass()
public static void setDebugLocation(java.lang.String debugLocation)
protected abstract void generate()
throws java.lang.Exception
public java.lang.Class define()
protected void declare_interfaces(java.lang.Class[] interfaces)
protected void declare_interface(java.lang.Class iface)
protected void declare_field(int modifiers,
java.lang.Class typeClass,
java.lang.String name)
protected void begin_method(int modifiers,
java.lang.Class returnType,
java.lang.String methodName,
java.lang.Class[] parameterTypes,
java.lang.Class[] exceptionTypes)
protected int getDefaultModifiers(java.lang.reflect.Method method)
protected void begin_method(java.lang.reflect.Method method)
protected void begin_method(java.lang.reflect.Method method,
int modifiers)
protected void begin_constructor(java.lang.reflect.Constructor constructor)
protected void begin_constructor()
protected void begin_constructor(java.lang.Class[] parameterTypes)
protected void begin_static()
protected void end_constructor()
protected void end_static()
protected void end_method()
protected void create_arg_array()
protected int begin_handler()
protected void end_handler()
protected void handle_exception(int ref,
java.lang.Class exceptionType)
protected void ifeq(java.lang.String label)
protected void ifne(java.lang.String label)
protected void iflt(java.lang.String label)
protected void ifge(java.lang.String label)
protected void ifgt(java.lang.String label)
protected void ifle(java.lang.String label)
protected void goTo(java.lang.String label)
protected void jsr(java.lang.String label)
protected void ifnull(java.lang.String label)
protected void ifnonnull(java.lang.String label)
protected void if_icmplt(java.lang.String label)
protected void if_icmpne(java.lang.String label)
protected void if_icmpeq(java.lang.String label)
protected void imul()
protected void iadd()
protected void lushr()
protected void lxor()
protected void ixor()
protected void l2i()
protected void dcmpg()
protected void fcmpg()
protected void lcmp()
protected void nop()
protected void nop(java.lang.String label)
protected void aconst_null()
protected void push(int i)
protected void push(long value)
protected void push(float value)
protected void push(double value)
protected void push(java.lang.String value)
protected void push(java.lang.Object[] array)
protected void push_object(java.lang.Object obj)
protected void newarray()
protected void newarray(java.lang.Class clazz)
protected void arraylength()
protected void array_load(java.lang.Class clazz)
protected void array_store(java.lang.Class clazz)
protected void load_this()
protected void load_class_this()
protected void load_class(java.lang.Class clazz)
protected void load_args()
protected void load_arg(int index)
index - the zero-based index into the argument list
protected void load_args(int fromArg,
int count)
protected void iinc(java.lang.String local,
int amount)
protected void local_type(java.lang.String name,
java.lang.Class type)
protected void store_local(java.lang.String name)
protected void load_local(java.lang.String name)
protected void pop()
protected void pop2()
protected void dup()
protected void dup2()
protected void dup_x1()
protected void dup_x2()
protected void swap()
protected void pop(java.lang.String label)
protected void dup(java.lang.String label)
protected void swap(java.lang.String label)
protected void return_value()
protected void getfield(java.lang.String name)
protected void putfield(java.lang.String name)
protected void getstatic(java.lang.String name)
protected void putstatic(java.lang.String name)
protected void super_getfield(java.lang.String name)
throws java.lang.NoSuchFieldException
protected void super_putfield(java.lang.String name)
throws java.lang.NoSuchFieldException
protected void getfield(java.lang.reflect.Field field)
protected void putfield(java.lang.reflect.Field field)
protected void invoke(java.lang.reflect.Method method)
protected void super_invoke(java.lang.reflect.Method method)
protected void invoke_virtual_this(java.lang.String methodName,
java.lang.Class returnType,
java.lang.Class[] parameterTypes)
protected void invoke_static_this(java.lang.String methodName,
java.lang.Class returnType,
java.lang.Class[] parameterTypes)
protected void super_invoke()
protected void invoke_constructor(java.lang.Class type)
protected void invoke_constructor(java.lang.Class type,
java.lang.Class[] parameterTypes)
public static org.apache.bcel.generic.Type getType(java.lang.Class cl)
protected static java.lang.String getMethodSignature(java.lang.reflect.Method method)
protected void invoke_virtual(java.lang.reflect.Method method)
protected void super_invoke_constructor(java.lang.reflect.Constructor constructor)
protected void super_invoke_constructor()
protected void super_invoke_constructor(java.lang.Class[] parameterTypes)
protected void invoke_constructor_this()
protected void invoke_constructor_this(java.lang.Class[] parameterTypes)
protected void new_instance_this()
protected void new_instance(java.lang.Class clazz)
protected void aaload(int index)
protected void aaload()
protected void aastore()
protected void athrow()
protected void athrow(java.lang.String label)
protected java.lang.String newLabel()
protected java.lang.String newLocal()
protected void zero_or_null(java.lang.Class type)
protected void unbox_or_zero(java.lang.Class type)
protected void box(java.lang.Class clazz)
clazz - the class indicating the current type of the top stack valueprotected void unbox(java.lang.Class clazz)
clazz - the class indicating the desired type of the top stack valueprotected void checkcast_this()
protected void checkcast(java.lang.Class clazz)
protected void instance_of(java.lang.Class clazz)
protected void instance_of_this()
protected void generateNullConstructor()
protected void process_array(java.lang.Class type,
CodeGenerator.ProcessArrayCallback callback)
type - the type of the array (type.isArray() must be true)callback - the callback triggered for each element
protected void process_arrays(java.lang.Class clazz,
CodeGenerator.ProcessArrayCallback callback)
clazz - the type of the arrays (clazz.isArray() must be true)callback - the callback triggered for each pair of elements
protected void not_equals(java.lang.Class clazz,
java.lang.String notEquals)
equals method for
Objects. Arrays are recursively processed in the same manner.
protected void throwException(java.lang.Class type,
java.lang.String msg)
protected void nullcmp(java.lang.String oneNull,
java.lang.String bothNull)
oneNull - label to branch to if only one of the objects is nullbothNull - label to branch to if both of the objects are null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||