TechTrader Bytecode Toolkit

com.techtrader.modules.tools.bytecode
Class LocalVariable

java.lang.Object
  |
  +--com.techtrader.modules.tools.bytecode.LocalVariable

public class LocalVariable
extends Object

Represents a local variable in a method. TODO: Add the ability to manipulate the local variable declaration at a high level.

Author:
Abe White

Constructor Summary
protected LocalVariable(LocalVariableTableAttribute owner)
          Protected constructor.
 
Method Summary
 void acceptVisit(BCVisitor visit)
           
 int getDescriptorIndex()
          Get the index in the constant pool of the UTF entry holding the descriptor of this local.
 int getIndex()
          Get the index into local variable table of the current frame for this variable.
 int getLength()
          Get the number of bytes for which this local variable has a value in the code byt array.
 String getName()
          Get the name of this local.
 int getNameIndex()
          Get the index into the constant pool of the UTF8Entry holding the name of this variable.
 LocalVariableTableAttribute getOwner()
          Local variables are contained in LocalVariableTableAttributds.
 int getStartPc()
          Get the start position of the program counter at which this local variable has a value.
 Class getType()
          Get the Class object for the type of this field.
 String getTypeName()
          Get the name of the type of this local.
protected  void invalidate()
          Used when the local is removed from the method, so that it can no longer affect the constant pool.
protected  void readData(DataInput in)
           
 void setDescriptorIndex(int index)
          Set the index in the constant pool of the UTF entry holding the descriptor of this local.
 void setIndex(int index)
          Set the index into local variable table of the current frame for this variable.
 void setLength(int length)
          Set the number of bytes for which this local variable has a value in the code byt array.
 void setName(String name)
          Set the name of this local.
 void setNameIndex(int nameIndex)
          Set the index into the constant pool of the UTF8Entry holding the name of this variable.
 void setStartPc(int startPc)
          Set the start position of the program counter at which this local variable has a value.
 void setType(Class type)
          Set the type of this field.
 void setTypeName(String name)
          Set the type name for this local.
protected  void writeData(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalVariable

protected LocalVariable(LocalVariableTableAttribute owner)
Protected constructor.
Method Detail

invalidate

protected void invalidate()
Used when the local is removed from the method, so that it can no longer affect the constant pool.

getOwner

public LocalVariableTableAttribute getOwner()
Local variables are contained in LocalVariableTableAttributds.

getIndex

public int getIndex()
Get the index into local variable table of the current frame for this variable.

setIndex

public void setIndex(int index)
Set the index into local variable table of the current frame for this variable.

getStartPc

public int getStartPc()
Get the start position of the program counter at which this local variable has a value. This is an index into the code byte array.

setStartPc

public void setStartPc(int startPc)
Set the start position of the program counter at which this local variable has a value. This is an index into the code byte array.

getLength

public int getLength()
Get the number of bytes for which this local variable has a value in the code byt array.

setLength

public void setLength(int length)
Set the number of bytes for which this local variable has a value in the code byt array.

getNameIndex

public int getNameIndex()
Get the index into the constant pool of the UTF8Entry holding the name of this variable.

setNameIndex

public void setNameIndex(int nameIndex)
Set the index into the constant pool of the UTF8Entry holding the name of this variable.

getName

public String getName()
Get the name of this local.

setName

public void setName(String name)
Set the name of this local.

getDescriptorIndex

public int getDescriptorIndex()
Get the index in the constant pool of the UTF entry holding the descriptor of this local.

setDescriptorIndex

public void setDescriptorIndex(int index)
Set the index in the constant pool of the UTF entry holding the descriptor of this local.

getTypeName

public String getTypeName()
Get the name of the type of this local.

setTypeName

public void setTypeName(String name)
Set the type name for this local.

getType

public Class getType()
              throws ClassNotFoundException
Get the Class object for the type of this field.

setType

public void setType(Class type)
Set the type of this field.

readData

protected void readData(DataInput in)
                 throws IOException

writeData

protected void writeData(DataOutput out)
                  throws IOException

acceptVisit

public void acceptVisit(BCVisitor visit)

TechTrader Bytecode Toolkit