org.apache.bcel.generic
Class LocalVariableGen
java.lang.Object
org.apache.bcel.generic.LocalVariableGen
- Cloneable, InstructionTargeter, NamedAndTyped, java.io.Serializable
public class LocalVariableGen
extends java.lang.Object
This class represents a local variable within a method. It contains its
scope, name and type. The generated LocalVariable object can be obtained
with getLocalVariable which needs the instruction list and the constant
pool as parameters.
$Id: LocalVariableGen.java,v 1.3 2002/07/11 19:39:04 mdahm Exp $
LocalVariableGen
public LocalVariableGen(int index,
String name,
Type type,
InstructionHandle start,
InstructionHandle end)
Generate a local variable that with index `index'. Note that double and long
variables need two indexs. Index indices have to be provided by the user.
index
- index of local variablename
- its nametype
- its typestart
- from where the instruction is valid (null means from the start)end
- until where the instruction is valid (null means to the end)
clone
public Object clone()
equals
public boolean equals(Object o)
We consider to local variables to be equal, if the use the same index and
are valid in the same range.
getIndex
public int getIndex()
getLocalVariable
public LocalVariable getLocalVariable(ConstantPoolGen cp)
Get LocalVariable object.
This relies on that the instruction list has already been dumped to byte code or
or that the `setPositions' methods has been called for the instruction list.
Note that for local variables whose scope end at the last
instruction of the method's code, the JVM specification is ambiguous:
both a start_pc+length ending at the last instruction and
start_pc+length ending at first index beyond the end of the code are
valid.
setIndex
public void setIndex(int index)
toString
public String toString()