TechTrader Bytecode Toolkit

com.techtrader.modules.tools.bytecode
Class TypedLocalVariableInstruction

java.lang.Object
  |
  +--com.techtrader.modules.tools.bytecode.Instruction
        |
        +--com.techtrader.modules.tools.bytecode.LocalVariableInstruction
              |
              +--com.techtrader.modules.tools.bytecode.TypedLocalVariableInstruction
Direct Known Subclasses:
LoadInstruction, StoreInstruction

public abstract class TypedLocalVariableInstruction
extends LocalVariableInstruction

An instruction manipulating a local variable that varies with the variable type.

Author:
Abe White

Field Summary
protected  Class _type
           
protected static Map _typeNames
           
 
Fields inherited from class com.techtrader.modules.tools.bytecode.LocalVariableInstruction
_index
 
Fields inherited from class com.techtrader.modules.tools.bytecode.Instruction
_byteIndex, _opcode, _opcodeTypes, _owner
 
Constructor Summary
protected TypedLocalVariableInstruction(Code owner)
           
 
Method Summary
protected  void copy(Instruction orig)
           
 boolean equals(Object other)
          Two local variable instructions are equal if the local index they reference is equal and their types are equal, or if either index is 0/unset.
 Class getType()
          Get the type of variable to load; this is one of: int, float, double, long, or Object.class.
 String getTypeName()
          Get the type of variable to load; this is one of: int, float, double, long, or java.lang.Object.
 TypedLocalVariableInstruction setType(Class type)
          Set the type of variable to load; Object types other than Object.class will be demoted to Object.class, and primitives that have no direct support (byte, char, boolean) will be conerted to int.class.
 TypedLocalVariableInstruction setTypeName(String name)
          Set the type to load by name.
 
Methods inherited from class com.techtrader.modules.tools.bytecode.LocalVariableInstruction
calculateOpCode, getIndex, setIndex
 
Methods inherited from class com.techtrader.modules.tools.bytecode.Instruction
acceptVisit, getByteIndex, getLength, getName, getOpCode, getOwner, getStackChange, invalidate, readData, setByteIndex, setOpCode, writeData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_typeNames

protected static final Map _typeNames

_type

protected Class _type
Constructor Detail

TypedLocalVariableInstruction

protected TypedLocalVariableInstruction(Code owner)
Method Detail

getType

public Class getType()
Get the type of variable to load; this is one of: int, float, double, long, or Object.class.

getTypeName

public String getTypeName()
Get the type of variable to load; this is one of: int, float, double, long, or java.lang.Object.

setType

public TypedLocalVariableInstruction setType(Class type)
Set the type of variable to load; Object types other than Object.class will be demoted to Object.class, and primitives that have no direct support (byte, char, boolean) will be conerted to int.class.
Returns:
this Instruction, for method chaining

setTypeName

public TypedLocalVariableInstruction setTypeName(String name)
Set the type to load by name.
Returns:
this Instruction, for method chaining
See Also:
setType(java.lang.Class)

equals

public boolean equals(Object other)
Two local variable instructions are equal if the local index they reference is equal and their types are equal, or if either index is 0/unset.
Overrides:
equals in class LocalVariableInstruction

copy

protected void copy(Instruction orig)
Overrides:
copy in class LocalVariableInstruction

TechTrader Bytecode Toolkit