org.jibx.binding.classes
Class InstructionBuilder

java.lang.Object
  extended byorg.apache.bcel.generic.InstructionFactory
      extended byorg.jibx.binding.classes.InstructionBuilder
All Implemented Interfaces:
org.apache.bcel.generic.InstructionConstants, java.io.Serializable

public class InstructionBuilder
extends org.apache.bcel.generic.InstructionFactory

Instruction builder. Extends the basic instruction construction tools in BCEL with some convenience methods.

Version:
1.0
Author:
Dennis M. Sosnoski
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.apache.bcel.generic.InstructionFactory
 
Nested classes inherited from class org.apache.bcel.generic.InstructionConstants
org.apache.bcel.generic.InstructionConstants.Clinit
 
Field Summary
 
Fields inherited from class org.apache.bcel.generic.InstructionFactory
cg, cp
 
Fields inherited from interface org.apache.bcel.generic.InstructionConstants
AALOAD, AASTORE, ACONST_NULL, ALOAD_0, ALOAD_1, ALOAD_2, ARETURN, ARRAYLENGTH, ASTORE_0, ASTORE_1, ASTORE_2, ATHROW, BALOAD, BASTORE, bla, CALOAD, CASTORE, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DMUL, DNEG, DREM, DRETURN, 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, FMUL, FNEG, FREM, FRETURN, FSUB, 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, ILOAD_0, ILOAD_1, ILOAD_2, IMUL, INEG, INSTRUCTIONS, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE_0, ISTORE_1, ISTORE_2, ISUB, IUSHR, IXOR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDIV, LMUL, LNEG, LOR, LREM, LRETURN, LSHL, LSHR, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, NOP, POP, POP2, RETURN, SALOAD, SASTORE, SWAP, THIS
 
Constructor Summary
InstructionBuilder(org.apache.bcel.generic.ClassGen cg, org.apache.bcel.generic.ConstantPoolGen cp)
          Constructor.
 
Method Summary
 org.apache.bcel.generic.InvokeInstruction createCallInit(java.lang.String name, java.lang.String signature)
          Create invoke initializer instruction from signature.
 org.apache.bcel.generic.InvokeInstruction createCallInterface(ClassItem item)
          Create invoke instruction for interface method.
 org.apache.bcel.generic.InvokeInstruction createCallInterface(java.lang.String method, java.lang.String signature)
          Create invoke interface method instruction from signature.
 org.apache.bcel.generic.InvokeInstruction createCallStatic(ClassItem item)
          Create invoke instruction for static method.
 org.apache.bcel.generic.InvokeInstruction createCallStatic(java.lang.String method, java.lang.String signature)
          Create invoke static method instruction from signature.
 org.apache.bcel.generic.InvokeInstruction createCallVirtual(ClassItem item)
          Create invoke instruction for virtual method.
 org.apache.bcel.generic.InvokeInstruction createCallVirtual(java.lang.String method, java.lang.String signature)
          Create invoke virtual method instruction from signature.
 org.apache.bcel.generic.FieldInstruction createGetField(ClassItem item)
          Create getfield instruction.
 org.apache.bcel.generic.FieldInstruction createGetStatic(ClassItem item)
          Create getstatic instruction.
 org.apache.bcel.generic.CompoundInstruction createLoadConstant(int value)
          Create load constant instruction.
 org.apache.bcel.generic.CompoundInstruction createLoadConstant(java.lang.Object value)
          Create load constant instruction.
 org.apache.bcel.generic.CompoundInstruction createLoadConstant(java.lang.String value)
          Create load constant instruction.
 org.apache.bcel.generic.FieldInstruction createPutField(ClassItem item)
          Create putfield instruction.
 org.apache.bcel.generic.FieldInstruction createPutStatic(ClassItem item)
          Create putstatic instruction.
 org.apache.bcel.generic.ConstantPoolGen getConstantPoolGen()
          Get constant pool generator.
 
Methods inherited from class org.apache.bcel.generic.InstructionFactory
createAppend, createArrayLoad, createArrayStore, createBinaryOperation, createBranchInstruction, createCast, createCheckCast, createConstant, createDup_1, createDup_2, createDup, createFieldAccess, createGetField, createGetStatic, createInstanceOf, createInvoke, createLoad, createNew, createNew, createNewArray, createNull, createPop, createPrintln, createPutField, createPutStatic, createReturn, createStore, createThis, getClassGen, getConstantPool, setClassGen, setConstantPool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstructionBuilder

public InstructionBuilder(org.apache.bcel.generic.ClassGen cg,
                          org.apache.bcel.generic.ConstantPoolGen cp)
Constructor.

Parameters:
cg - class generation information
cp - constant pool generator
Method Detail

getConstantPoolGen

public org.apache.bcel.generic.ConstantPoolGen getConstantPoolGen()
Get constant pool generator.

Returns:
constant pool generator for class

createLoadConstant

public org.apache.bcel.generic.CompoundInstruction createLoadConstant(int value)
Create load constant instruction. Builds the most appropriate type of instruction for the value.

Parameters:
value - constant value to be loaded
Returns:
generated instruction information

createLoadConstant

public org.apache.bcel.generic.CompoundInstruction createLoadConstant(java.lang.String value)
Create load constant instruction. Loads a String reference from the constant pool.

Parameters:
value - constant value to be loaded
Returns:
generated instruction information

createLoadConstant

public org.apache.bcel.generic.CompoundInstruction createLoadConstant(java.lang.Object value)
Create load constant instruction. Loads an unwrapped primitive value or String from the constant pool.

Parameters:
value - constant value to be loaded
Returns:
generated instruction information

createGetField

public org.apache.bcel.generic.FieldInstruction createGetField(ClassItem item)
Create getfield instruction. Uses the field information to generate the instruction.

Parameters:
item - information for field to be set
Returns:
generated instruction information

createPutField

public org.apache.bcel.generic.FieldInstruction createPutField(ClassItem item)
Create putfield instruction. Uses the field information to generate the instruction.

Parameters:
item - information for field to be set
Returns:
generated instruction information

createGetStatic

public org.apache.bcel.generic.FieldInstruction createGetStatic(ClassItem item)
Create getstatic instruction. Uses the field information to generate the instruction.

Parameters:
item - information for field to be set
Returns:
generated instruction information

createPutStatic

public org.apache.bcel.generic.FieldInstruction createPutStatic(ClassItem item)
Create putstatic instruction. Uses the field information to generate the instruction.

Parameters:
item - information for field to be set
Returns:
generated instruction information

createCallStatic

public org.apache.bcel.generic.InvokeInstruction createCallStatic(ClassItem item)
Create invoke instruction for static method. Uses the method information to generate the instruction.

Parameters:
item - information for method to be called
Returns:
generated instruction information

createCallVirtual

public org.apache.bcel.generic.InvokeInstruction createCallVirtual(ClassItem item)
Create invoke instruction for virtual method. Uses the method information to generate the instruction.

Parameters:
item - information for method to be called
Returns:
generated instruction information

createCallInterface

public org.apache.bcel.generic.InvokeInstruction createCallInterface(ClassItem item)
Create invoke instruction for interface method. Uses the method information to generate the instruction.

Parameters:
item - information for method to be called
Returns:
generated instruction information

createCallStatic

public org.apache.bcel.generic.InvokeInstruction createCallStatic(java.lang.String method,
                                                                  java.lang.String signature)
Create invoke static method instruction from signature.

Parameters:
method - fully qualified class and method name
signature - method signature in standard form
Returns:
generated instruction information

createCallVirtual

public org.apache.bcel.generic.InvokeInstruction createCallVirtual(java.lang.String method,
                                                                   java.lang.String signature)
Create invoke virtual method instruction from signature.

Parameters:
method - fully qualified class and method name
signature - method signature in standard form
Returns:
generated instruction information

createCallInterface

public org.apache.bcel.generic.InvokeInstruction createCallInterface(java.lang.String method,
                                                                     java.lang.String signature)
Create invoke interface method instruction from signature.

Parameters:
method - fully qualified interface and method name
signature - method signature in standard form
Returns:
generated instruction information

createCallInit

public org.apache.bcel.generic.InvokeInstruction createCallInit(java.lang.String name,
                                                                java.lang.String signature)
Create invoke initializer instruction from signature.

Parameters:
name - fully qualified class name
signature - method signature in standard form
Returns:
generated instruction information


Project Web Site