Package org.apache.tapestry5.internal.plastic

## Class InstructionBuilderImpl

- java.lang.Object
- - org.apache.tapestry5.internal.plastic.Lockable
  - - org.apache.tapestry5.internal.plastic.InstructionBuilderImpl

- All Implemented Interfaces:
    `org.apache.tapestry5.internal.plastic.asm.Opcodes`, `InstructionBuilder`

      public class InstructionBuilderImpl
      extends Lockable
      implements org.apache.tapestry5.internal.plastic.asm.Opcodes, InstructionBuilder

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected NameCache` | `cache` |
    `protected InstructionBuilderState` | `state` |
    `protected org.apache.tapestry5.internal.plastic.asm.MethodVisitor` | `v` |

    - ### Fields inherited from interface org.apache.tapestry5.internal.plastic.asm.Opcodes

      `AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_MANDATED, ACC_MODULE, ACC_NATIVE, ACC_OPEN, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_RECORD, ACC_STATIC, ACC_STATIC_PHASE, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_TRANSITIVE, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASM10_EXPERIMENTAL, ASM4, ASM5, ASM6, ASM7, ASM8, ASM9, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DOUBLE, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F_APPEND, F_CHOP, F_FULL, F_NEW, F_SAME, F_SAME1, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAT, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, H_GETFIELD, H_GETSTATIC, H_INVOKEINTERFACE, H_INVOKESPECIAL, H_INVOKESTATIC, H_INVOKEVIRTUAL, H_NEWINVOKESPECIAL, H_PUTFIELD, H_PUTSTATIC, 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, ILOAD, IMUL, INEG, INSTANCEOF, INTEGER, INVOKEDYNAMIC, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LONG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SOURCE_DEPRECATED, SOURCE_MASK, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, TOP, UNINITIALIZED_THIS, V_PREVIEW, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V10, V11, V12, V13, V14, V15, V16, V17, V18, V9`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `InstructionBuilder` | `arrayLength()` | Expects the top object on the stack to be an array.
    `InstructionBuilder` | `boxPrimitive​(String typeName)` | If the type name is a primitive type, adds code to box the type into the equivalent wrapper type, using static methods on the wrapper type.
    `InstructionBuilder` | `castOrUnbox​(String typeName)` | Casts the object on top of the stack to the indicated type.
    `InstructionBuilder` | `checkcast​(Class clazz)` |
    `InstructionBuilder` | `checkcast​(String className)` | Adds a check that the object on top of the stack is assignable to the indicated class.
    `InstructionBuilder` | `compareSpecial​(String typeName)` | Special comparison logic for primitive float, double and long.
    `InstructionBuilder` | `doWhile​(Condition condition, WhileCallback callback)` | Implements a simple loop based on a condition.
    `InstructionBuilder` | `dupe()` | Duplicates the top object on the stack.
    `InstructionBuilder` | `dupe​(int depth)` | Duplicates the top object on the stack, placing the result at some depth.
    `InstructionBuilder` | `dupeWide()` | Duplicates a wide value (a primitive long or double).
    `InstructionBuilder` | `getField​(String className, String fieldName, Class fieldType)` | Loads a field onto the stack.
    `InstructionBuilder` | `getField​(String className, String fieldName, String typeName)` | Loads an instance field onto the stack.
    `InstructionBuilder` | `getField​(PlasticField field)` | Loads an instance or static field onto the stack.
    `InstructionBuilder` | `getStaticField​(String className, String fieldName, Class fieldType)` | Gets a static field; does not consume a value from the stack, but pushes the fields' value onto the stack.
    `InstructionBuilder` | `getStaticField​(String className, String fieldName, String typeName)` | Gets a static field; does not consume a value from the stack, but pushes the fields' value onto the stack.
    `InstructionBuilder` | `increment​(LocalVariable variable)` | Increments a local integer variable.
    `InstructionBuilder` | `invoke​(Class clazz, Class returnType, String methodName, Class... argumentTypes)` | Automatically invokes an interface or virtual method.
    `InstructionBuilder` | `invoke​(Method method)` | Automatically invokes an interface or virtual method.
    `InstructionBuilder` | `invokeConstructor​(Class clazz, Class... argumentTypes)` |
    `InstructionBuilder` | `invokeConstructor​(String className, String... argumentTypes)` | Invokes a constructor on a class.
    `InstructionBuilder` | `invokeInterface​(String interfaceName, String returnType, String methodName, String... argumentTypes)` | Invokes a standard virtual method.
    `InstructionBuilder` | `invokeSpecial​(String containingClassName, MethodDescription description)` | Invokes an instance method of a base class, or a private method of a class, using the target object and parameters already on the stack.
    `InstructionBuilder` | `invokeStatic​(Class clazz, Class returnType, String methodName, Class... argumentTypes)` | Invokes a static method of a class.
    `InstructionBuilder` | `invokeVirtual​(String className, String returnType, String methodName, String... argumentTypes)` | Invokes a standard virtual method.
    `InstructionBuilder` | `invokeVirtual​(PlasticMethod method)` |
    `InstructionBuilder` | `iterateArray​(InstructionBuilderCallback callback)` | Expects an array to be the top value on the stack.
    `InstructionBuilder` | `loadArgument​(int index)` | Loads an argument onto the stack, using the opcode appropriate to the argument's type.
    `InstructionBuilder` | `loadArguments()` | Loads all arguments for the current method onto the stack; this is used when invoking a method that takes the exact same parameters (often, a super-class implementation).
    `InstructionBuilder` | `loadArrayElement()` | Loads a value from an array object.
    `InstructionBuilder` | `loadArrayElement​(int index, String elementType)` | Loads a value from an array object, which must be the top element of the stack.
    `InstructionBuilder` | `loadConstant​(Object constant)` | Loads a constant value
    `InstructionBuilder` | `loadNull()` | Loads the null constant onto the stack.
    `InstructionBuilder` | `loadThis()` | Loads this onto the stack.
    `InstructionBuilder` | `loadTypeConstant​(Class clazz)` | Loads a Java type (a Class instance) as a constant.
    `InstructionBuilder` | `loadTypeConstant​(String typeName)` | Loads a Java type (a Class instance) as a constant.
    `InstructionBuilder` | `loadVariable​(LocalVariable var)` | Loads a value from a local variable and pushes it onto the stack.
    `InstructionBuilder` | `newInstance​(Class clazz)` | A convenience version of `InstructionBuilder.newInstance(String)` used when the class is known at build time.
    `InstructionBuilder` | `newInstance​(String className)` | Creates a new, uninitialized instance of the indicated class.
    `InstructionBuilder` | `pop()` | Discards the top value on the stack.
    `InstructionBuilder` | `popWide()` | Pops a wide value (a primitive long or double).
    `InstructionBuilder` | `putField​(String className, String fieldName, Class fieldType)` |
    `InstructionBuilder` | `putField​(String className, String fieldName, String typeName)` | Expects the stack to contain the instance to update, and the value to store into the field.
    `InstructionBuilder` | `putStaticField​(String className, String fieldName, Class fieldType)` | Sets a static field; the new field value should be on top of the stack.
    `InstructionBuilder` | `putStaticField​(String className, String fieldName, String typeName)` | Sets a static field; the new field value should be on top of the stack.
    `InstructionBuilder` | `returnDefaultValue()` | Returns the default value for the method, which may be null, or a specific primitive value.
    `InstructionBuilder` | `returnResult()` | Returns the top value on the stack.
    `InstructionBuilder` | `startSwitch​(int min, int max, SwitchCallback callback)` | Starts a switch statement.
    `InstructionBuilder` | `startTryCatch​(TryCatchCallback callback)` | Defines the start of a block that can have exception handlers and finally blocks applied.
    `InstructionBuilder` | `startVariable​(String type, LocalVariableCallback callback)` | Starts a block where the given name is active.
    `InstructionBuilder` | `storeVariable​(LocalVariable var)` | Stores the value on top of the stack to a local variable (previously defined by `InstructionBuilder.startVariable(String, LocalVariableCallback)`.
    `InstructionBuilder` | `swap()` | Swaps the top element of the stack with the next element down.
    `InstructionBuilder` | `throwException()` | Throws the exception on the top of the stack.
    `InstructionBuilder` | `throwException​(Class<? extends Throwable> exceptionType, String message)` |
    `InstructionBuilder` | `throwException​(String className, String message)` | Throws an exception with a fixed message.
    `InstructionBuilder` | `unboxPrimitive​(String typeName)` | Unboxes a wrapper type to a primitive type if typeName is a primitive type name (the value on the stack should be the corresponding wrapper type instance).
    `InstructionBuilder` | `when​(Condition condition, InstructionBuilderCallback ifTrue)` | Simplified version of `InstructionBuilder.when(Condition, WhenCallback)` that simply executes the callback code when the condition is true and does nothing if the condition is false (the more general case).
    `InstructionBuilder` | `when​(Condition condition, WhenCallback callback)` | Executes conditional code based on a `Condition`.

    - ### Methods inherited from class org.apache.tapestry5.internal.plastic.Lockable

      `check, lock`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### state

          protected final InstructionBuilderState state

    - #### v

          protected final org.apache.tapestry5.internal.plastic.asm.MethodVisitor v

    - #### cache

          protected final NameCache cache

  - ### Method Detail

    - #### returnDefaultValue

          public InstructionBuilder returnDefaultValue()

      Description copied from interface: `InstructionBuilder`
      Returns the default value for the method, which may be null, or a specific primitive value.
      Specified by:
        `returnDefaultValue` in interface `InstructionBuilder`

    - #### loadThis

          public InstructionBuilder loadThis()

      Description copied from interface: `InstructionBuilder`
      Loads this onto the stack.
      Specified by:
        `loadThis` in interface `InstructionBuilder`

    - #### loadNull

          public InstructionBuilder loadNull()

      Description copied from interface: `InstructionBuilder`
      Loads the null constant onto the stack.
      Specified by:
        `loadNull` in interface `InstructionBuilder`

    - #### loadArgument

          public InstructionBuilder loadArgument​(int index)

      Description copied from interface: `InstructionBuilder`
      Loads an argument onto the stack, using the opcode appropriate to the argument's type. In addition this automatically adjusts for arguments of primitive type long or double (which take up two local variable indexes, rather than one as for all other types)
      Specified by:
        `loadArgument` in interface `InstructionBuilder`
      Parameters:
        `index` - to argument (0 is the first argument, not this)

    - #### loadArguments

          public InstructionBuilder loadArguments()

      Description copied from interface: `InstructionBuilder`
      Loads all arguments for the current method onto the stack; this is used when invoking a method that takes the exact same parameters (often, a super-class implementation). A call to `InstructionBuilder.loadThis()` (or some other way of identifying the target method) should precede this call.
      Specified by:
        `loadArguments` in interface `InstructionBuilder`

    - #### invokeSpecial

          public InstructionBuilder invokeSpecial​(String containingClassName,
                                                  MethodDescription description)

      Description copied from interface: `InstructionBuilder`
      Invokes an instance method of a base class, or a private method of a class, using the target object and parameters already on the stack. Leaves the result on the stack (unless its a void method).
      Specified by:
        `invokeSpecial` in interface `InstructionBuilder`
      Parameters:
        `containingClassName` - class name containing the method
        `description` - describes the method name, parameters and return type

    - #### invokeVirtual

          public InstructionBuilder invokeVirtual​(PlasticMethod method)

      Specified by:
        `invokeVirtual` in interface `InstructionBuilder`

    - #### invokeVirtual

          public InstructionBuilder invokeVirtual​(String className,
                                                  String returnType,
                                                  String methodName,
                                                  String... argumentTypes)

      Description copied from interface: `InstructionBuilder`
      Invokes a standard virtual method.
      Specified by:
        `invokeVirtual` in interface `InstructionBuilder`

    - #### invokeInterface

          public InstructionBuilder invokeInterface​(String interfaceName,
                                                    String returnType,
                                                    String methodName,
                                                    String... argumentTypes)

      Description copied from interface: `InstructionBuilder`
      Invokes a standard virtual method.
      Specified by:
        `invokeInterface` in interface `InstructionBuilder`

    - #### invokeStatic

          public InstructionBuilder invokeStatic​(Class clazz,
                                                 Class returnType,
                                                 String methodName,
                                                 Class... argumentTypes)

      Description copied from interface: `InstructionBuilder`
      Invokes a static method of a class.
      Specified by:
        `invokeStatic` in interface `InstructionBuilder`

    - #### invoke

          public InstructionBuilder invoke​(Method method)

      Description copied from interface: `InstructionBuilder`
      Automatically invokes an interface or virtual method. Remember to use `InstructionBuilder.invokeConstructor(Class, Class...)` for constructors and `InstructionBuilder.invokeSpecial(String, MethodDescription)` for private methods.
      Specified by:
        `invoke` in interface `InstructionBuilder`

    - #### invoke

          public InstructionBuilder invoke​(Class clazz,
                                           Class returnType,
                                           String methodName,
                                           Class... argumentTypes)

      Description copied from interface: `InstructionBuilder`
      Automatically invokes an interface or virtual method. Remember to use `InstructionBuilder.invokeConstructor(Class, Class...)` for constructors and `InstructionBuilder.invokeSpecial(String, MethodDescription)` for private methods.
      Specified by:
        `invoke` in interface `InstructionBuilder`

    - #### returnResult

          public InstructionBuilder returnResult()

      Description copied from interface: `InstructionBuilder`
      Returns the top value on the stack. For void methods, no value should be on the stack and the method will simply return.
      Specified by:
        `returnResult` in interface `InstructionBuilder`

    - #### boxPrimitive

          public InstructionBuilder boxPrimitive​(String typeName)

      Description copied from interface: `InstructionBuilder`
      If the type name is a primitive type, adds code to box the type into the equivalent wrapper type, using static methods on the wrapper type. Does nothing if the type is not primitive, or type void.
      Specified by:
        `boxPrimitive` in interface `InstructionBuilder`

    - #### unboxPrimitive

          public InstructionBuilder unboxPrimitive​(String typeName)

      Description copied from interface: `InstructionBuilder`
      Unboxes a wrapper type to a primitive type if typeName is a primitive type name (the value on the stack should be the corresponding wrapper type instance). Does nothing for non-primitive types.
      Specified by:
        `unboxPrimitive` in interface `InstructionBuilder`
      Parameters:
        `typeName` - possibly primitive type name

    - #### getField

          public InstructionBuilder getField​(String className,
                                             String fieldName,
                                             String typeName)

      Description copied from interface: `InstructionBuilder`
      Loads an instance field onto the stack. The object containing the field should already be loaded onto the stack (usually, via `InstructionBuilder.loadThis()`).
      Specified by:
        `getField` in interface `InstructionBuilder`
      Parameters:
        `className` - name of class containing the field
        `fieldName` - name of the field
        `typeName` - type of field

    - #### getStaticField

          public InstructionBuilder getStaticField​(String className,
                                                   String fieldName,
                                                   String typeName)

      Description copied from interface: `InstructionBuilder`
      Gets a static field; does not consume a value from the stack, but pushes the fields' value onto the stack.
      Specified by:
        `getStaticField` in interface `InstructionBuilder`
      Parameters:
        `className` - name of class containing the field
        `fieldName` - name of the field
        `typeName` - type of field

    - #### getStaticField

          public InstructionBuilder getStaticField​(String className,
                                                   String fieldName,
                                                   Class fieldType)

      Description copied from interface: `InstructionBuilder`
      Gets a static field; does not consume a value from the stack, but pushes the fields' value onto the stack.
      Specified by:
        `getStaticField` in interface `InstructionBuilder`
      Parameters:
        `className` - name of class containing the field
        `fieldName` - name of the field
        `fieldType` - type of field

    - #### putStaticField

          public InstructionBuilder putStaticField​(String className,
                                                   String fieldName,
                                                   Class fieldType)

      Description copied from interface: `InstructionBuilder`
      Sets a static field; the new field value should be on top of the stack.
      Specified by:
        `putStaticField` in interface `InstructionBuilder`
      Parameters:
        `className` - name of class containing the field
        `fieldName` - name of the field
        `fieldType` - type of field

    - #### putStaticField

          public InstructionBuilder putStaticField​(String className,
                                                   String fieldName,
                                                   String typeName)

      Description copied from interface: `InstructionBuilder`
      Sets a static field; the new field value should be on top of the stack.
      Specified by:
        `putStaticField` in interface `InstructionBuilder`
      Parameters:
        `className` - name of class containing the field
        `fieldName` - name of the field
        `typeName` - type of field

    - #### getField

          public InstructionBuilder getField​(PlasticField field)

      Description copied from interface: `InstructionBuilder`
      Loads an instance or static field onto the stack. The plastic class instance containing the field should already be loaded onto the stack (usually, via `InstructionBuilder.loadThis()`).
      Specified by:
        `getField` in interface `InstructionBuilder`
      Parameters:
        `field` - identifies name, type and container of field to load

    - #### putField

          public InstructionBuilder putField​(String className,
                                             String fieldName,
                                             String typeName)

      Description copied from interface: `InstructionBuilder`
      Expects the stack to contain the instance to update, and the value to store into the field.
      Specified by:
        `putField` in interface `InstructionBuilder`

    - #### putField

          public InstructionBuilder putField​(String className,
                                             String fieldName,
                                             Class fieldType)

      Specified by:
        `putField` in interface `InstructionBuilder`

    - #### getField

          public InstructionBuilder getField​(String className,
                                             String fieldName,
                                             Class fieldType)

      Description copied from interface: `InstructionBuilder`
      Loads a field onto the stack. This version is used when the field type is known at build time, rather than discovered at runtime.
      Specified by:
        `getField` in interface `InstructionBuilder`
      Parameters:
        `className` - name of class containing the field
        `fieldName` - name of the field
        `fieldType` - type of field

    - #### loadArrayElement

          public InstructionBuilder loadArrayElement​(int index,
                                                     String elementType)

      Description copied from interface: `InstructionBuilder`
      Loads a value from an array object, which must be the top element of the stack.
      Specified by:
        `loadArrayElement` in interface `InstructionBuilder`
      Parameters:
        `index` - constant index into the array
        `elementType` - the type name of the elements of the array Note: currently only reference types (objects and arrays) are supported, not primitives

    - #### loadArrayElement

          public InstructionBuilder loadArrayElement()

      Description copied from interface: `InstructionBuilder`
      Loads a value from an array object. The stack should have the array at depth 1, and an array index on top. Only object arrays (not arrays of primitives) are supported.
      Specified by:
        `loadArrayElement` in interface `InstructionBuilder`

    - #### checkcast

          public InstructionBuilder checkcast​(String className)

      Description copied from interface: `InstructionBuilder`
      Adds a check that the object on top of the stack is assignable to the indicated class.
      Specified by:
        `checkcast` in interface `InstructionBuilder`
      Parameters:
        `className` - class to cast to

    - #### checkcast

          public InstructionBuilder checkcast​(Class clazz)

      Specified by:
        `checkcast` in interface `InstructionBuilder`

    - #### startTryCatch

          public InstructionBuilder startTryCatch​(TryCatchCallback callback)

      Description copied from interface: `InstructionBuilder`
      Defines the start of a block that can have exception handlers and finally blocks applied. Continue using this InstructionBuilder to define code inside the block, then call methods on the InstructionBlock to define the end of the block and set up handlers.
      Specified by:
        `startTryCatch` in interface `InstructionBuilder`
      Parameters:
        `callback` - allows generation of try, catch, and finally clauses

    - #### newInstance

          public InstructionBuilder newInstance​(String className)

      Description copied from interface: `InstructionBuilder`
      Creates a new, uninitialized instance of the indicated class. This should be followed by code to call the new instance's constructor.
      Specified by:
        `newInstance` in interface `InstructionBuilder`
      Parameters:
        `className` - of class to instantiate

    - #### newInstance

          public InstructionBuilder newInstance​(Class clazz)

      Description copied from interface: `InstructionBuilder`
      A convenience version of `InstructionBuilder.newInstance(String)` used when the class is known at build time.
      Specified by:
        `newInstance` in interface `InstructionBuilder`
      Parameters:
        `clazz` - to instantiate

    - #### invokeConstructor

          public InstructionBuilder invokeConstructor​(String className,
                                                      String... argumentTypes)

      Description copied from interface: `InstructionBuilder`
      Invokes a constructor on a class. The instance should already be on the stack, followed by the right number and type of parameters. Note that a constructor acts like a void method, so you will often follow the sequence: newInstance(), dupe(0), invokeConstructor() so that a reference to the instance is left on the stack.F
      Specified by:
        `invokeConstructor` in interface `InstructionBuilder`
      Parameters:
        `className` - the class containing the constructor
        `argumentTypes` - java type names for each argument of the constructor

    - #### invokeConstructor

          public InstructionBuilder invokeConstructor​(Class clazz,
                                                      Class... argumentTypes)

      Specified by:
        `invokeConstructor` in interface `InstructionBuilder`

    - #### dupe

          public InstructionBuilder dupe​(int depth)

      Description copied from interface: `InstructionBuilder`
      Duplicates the top object on the stack, placing the result at some depth.
      Specified by:
        `dupe` in interface `InstructionBuilder`
      Parameters:
        `depth` - 0 (DUP), 1 (DUP_X1) or 2 (DUP_X2)

    - #### dupe

          public InstructionBuilder dupe()

      Description copied from interface: `InstructionBuilder`
      Duplicates the top object on the stack. Commonly used with `InstructionBuilder.when(Condition, WhenCallback)`.
      Specified by:
        `dupe` in interface `InstructionBuilder`
      See Also:
        `InstructionBuilder.dupe(int)`

    - #### pop

          public InstructionBuilder pop()

      Description copied from interface: `InstructionBuilder`
      Discards the top value on the stack. Assumes the value is a single word value: an object reference, or a small primitive) and not a double or long.
      Specified by:
        `pop` in interface `InstructionBuilder`

    - #### swap

          public InstructionBuilder swap()

      Description copied from interface: `InstructionBuilder`
      Swaps the top element of the stack with the next element down. Note that this can cause problems if the top element on the stack is a long or double.
      Specified by:
        `swap` in interface `InstructionBuilder`

    - #### loadConstant

          public InstructionBuilder loadConstant​(Object constant)

      Description copied from interface: `InstructionBuilder`
      Loads a constant value
      Specified by:
        `loadConstant` in interface `InstructionBuilder`
      Parameters:
        `constant` - Integer, Float, Double, Long, String or null

    - #### loadTypeConstant

          public InstructionBuilder loadTypeConstant​(String typeName)

      Description copied from interface: `InstructionBuilder`
      Loads a Java type (a Class instance) as a constant. This assumes the type name is the name of class (or array) but not a primitive type.
      Specified by:
        `loadTypeConstant` in interface `InstructionBuilder`
      Parameters:
        `typeName` - Java class name

    - #### loadTypeConstant

          public InstructionBuilder loadTypeConstant​(Class clazz)

      Description copied from interface: `InstructionBuilder`
      Loads a Java type (a Class instance) as a constant. This assumes the type name is the name of class (or array) but not a primitive type.
      Specified by:
        `loadTypeConstant` in interface `InstructionBuilder`
      Parameters:
        `clazz` - Java type to load as a constant

    - #### castOrUnbox

          public InstructionBuilder castOrUnbox​(String typeName)

      Description copied from interface: `InstructionBuilder`
      Casts the object on top of the stack to the indicated type. For primitive types, casts to the wrapper type and invokes the appropriate unboxing static method call, leaving a primitive type value on the stack.
      Specified by:
        `castOrUnbox` in interface `InstructionBuilder`
      Parameters:
        `typeName` - to cast or unbox to

    - #### throwException

          public InstructionBuilder throwException​(String className,
                                                   String message)

      Description copied from interface: `InstructionBuilder`
      Throws an exception with a fixed message. Assumes the exception class includes a constructor that takes a single string.
      Specified by:
        `throwException` in interface `InstructionBuilder`
      Parameters:
        `className` - name of exception class to instantiate
        `message` - message (passed as first and only parameter to constructor)

    - #### throwException

          public InstructionBuilder throwException​(Class<? extends Throwable> exceptionType,
                                                   String message)

      Specified by:
        `throwException` in interface `InstructionBuilder`

    - #### throwException

          public InstructionBuilder throwException()

      Description copied from interface: `InstructionBuilder`
      Throws the exception on the top of the stack.
      Specified by:
        `throwException` in interface `InstructionBuilder`

    - #### startSwitch

          public InstructionBuilder startSwitch​(int min,
                                                int max,
                                                SwitchCallback callback)

      Description copied from interface: `InstructionBuilder`
      Starts a switch statement.
      Specified by:
        `startSwitch` in interface `InstructionBuilder`
      Parameters:
        `min` - the minimum value to match against
        `max` - the maximum value to match against

    - #### startVariable

          public InstructionBuilder startVariable​(String type,
                                                  LocalVariableCallback callback)

      Description copied from interface: `InstructionBuilder`
      Starts a block where the given name is active.
      Specified by:
        `startVariable` in interface `InstructionBuilder`
      Parameters:
        `type` - type of local variable
        `callback` - generates code used when variable is in effect

    - #### storeVariable

          public InstructionBuilder storeVariable​(LocalVariable var)

      Description copied from interface: `InstructionBuilder`
      Stores the value on top of the stack to a local variable (previously defined by `InstructionBuilder.startVariable(String, LocalVariableCallback)`.
      Specified by:
        `storeVariable` in interface `InstructionBuilder`

    - #### loadVariable

          public InstructionBuilder loadVariable​(LocalVariable var)

      Description copied from interface: `InstructionBuilder`
      Loads a value from a local variable and pushes it onto the stack. The variable is defined by `InstructionBuilder.startVariable(String, LocalVariableCallback)`.
      Specified by:
        `loadVariable` in interface `InstructionBuilder`

    - #### when

          public InstructionBuilder when​(Condition condition,
                                         InstructionBuilderCallback ifTrue)

      Description copied from interface: `InstructionBuilder`
      Simplified version of `InstructionBuilder.when(Condition, WhenCallback)` that simply executes the callback code when the condition is true and does nothing if the condition is false (the more general case). The testing opcodes all pop the value off the stack, so this is usually preceded by `dupe(0)`.
      Specified by:
        `when` in interface `InstructionBuilder`
      Parameters:
        `condition` - to evaluate
        `ifTrue` - generates code for when condition is true
      Returns:
        this builder

    - #### when

          public InstructionBuilder when​(Condition condition,
                                         WhenCallback callback)

      Description copied from interface: `InstructionBuilder`
      Executes conditional code based on a `Condition`. The testing opcodes all pop the value off the stack, so this is usually preceded by `dupe(0)`.
      Specified by:
        `when` in interface `InstructionBuilder`
      Parameters:
        `condition` - defines true and false cases
        `callback` - provides code for true and false blocks
      Returns:
        this builder

    - #### doWhile

          public InstructionBuilder doWhile​(Condition condition,
                                            WhileCallback callback)

      Description copied from interface: `InstructionBuilder`
      Implements a simple loop based on a condition. First the WhileCallback.buildTest(InstructionBuilder) code is executed, then the condition is evaluated (which will consume at least the top value on the stack). When the condition is false, the loop is exited. When the condition is true, the code defined by `WhileCallback.buildBody(InstructionBuilder)` is executed, and then a GOTO back to the test code.
      Specified by:
        `doWhile` in interface `InstructionBuilder`
      Returns:
        this builder

    - #### increment

          public InstructionBuilder increment​(LocalVariable variable)

      Description copied from interface: `InstructionBuilder`
      Increments a local integer variable.
      Specified by:
        `increment` in interface `InstructionBuilder`
      Returns:
        this builder

    - #### arrayLength

          public InstructionBuilder arrayLength()

      Description copied from interface: `InstructionBuilder`
      Expects the top object on the stack to be an array. Replaces it with the length of that array.
      Specified by:
        `arrayLength` in interface `InstructionBuilder`

    - #### iterateArray

          public InstructionBuilder iterateArray​(InstructionBuilderCallback callback)

      Description copied from interface: `InstructionBuilder`
      Expects an array to be the top value on the stack. Iterates the array. The callback generates code that will have each successive value from the array as the top value on the stack. Creates a variable to store the loop index.
      Specified by:
        `iterateArray` in interface `InstructionBuilder`
      Parameters:
        `callback` - to invoke. The element will be the top value on the stack. The callback is responsible for removing it from the stack.
      Returns:
        this builder

    - #### dupeWide

          public InstructionBuilder dupeWide()

      Description copied from interface: `InstructionBuilder`
      Duplicates a wide value (a primitive long or double).
      Specified by:
        `dupeWide` in interface `InstructionBuilder`

    - #### popWide

          public InstructionBuilder popWide()

      Description copied from interface: `InstructionBuilder`
      Pops a wide value (a primitive long or double).
      Specified by:
        `popWide` in interface `InstructionBuilder`

    - #### compareSpecial

          public InstructionBuilder compareSpecial​(String typeName)

      Description copied from interface: `InstructionBuilder`
      Special comparison logic for primitive float, double and long. Expect two matching wide values on the stack. Reduces the two wide values to a single int value: -1, 0, or 1 depending on whether the deeper value is less than, equal to, or greater than the top value on the stack.
      Specified by:
        `compareSpecial` in interface `InstructionBuilder`