Class InstructionBuilder

InstructionFactory
org.jibx.binding.classes.InstructionBuilder

public class InstructionBuilder extends InstructionFactory
Instruction builder. Extends the basic instruction construction tools in BCEL with some convenience methods.
Version:
1.0
Author:
Dennis M. Sosnoski
  • Constructor Details

    • InstructionBuilder

      public InstructionBuilder(ClassGen cg, ConstantPoolGen cp)
      Constructor.
      Parameters:
      cg - class generation information
      cp - constant pool generator
  • Method Details

    • getConstantPoolGen

      public ConstantPoolGen getConstantPoolGen()
      Get constant pool generator.
      Returns:
      constant pool generator for class
    • createLoadConstant

      public 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 CompoundInstruction createLoadConstant(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 CompoundInstruction createLoadConstant(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 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 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 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 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 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 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 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 InvokeInstruction createCallStatic(String method, 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 InvokeInstruction createCallVirtual(String method, 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 InvokeInstruction createCallInterface(String method, 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 InvokeInstruction createCallInit(String name, String signature)
      Create invoke initializer instruction from signature.
      Parameters:
      name - fully qualified class name
      signature - method signature in standard form
      Returns:
      generated instruction information