jellyj.classfile.classgen
Class LocalVariableGen


public final class LocalVariableGen
implements Constants

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.

Author:
JellyJ Design Group
See Also: LocalVariable, Instruction, MethodGen

Constructor Summary
LocalVariableGen(int slot, String name, ClassGenType type, InstructionHandle start, InstructionHandle end)
          Generate a local variable that with index `slot'.

Method Summary
 InstructionHandlegetEnd()
           
 LocalVariablegetLocalVariable(InstructionList il, ConstantPoolGen cp)
          Get LocalVariable object.
 StringgetName()
           
 intgetSlot()
           
 InstructionHandlegetStart()
           
 ClassGenTypegetType()
           
 voidsetEnd(InstructionHandle end)
           
 voidsetName(String name)
           
 voidsetSlot(int slot)
           
 voidsetStart(InstructionHandle start)
           
 voidsetType(ClassGenType type)
           

Constructor Detail

LocalVariableGen

public LocalVariableGen(int slot, String name, ClassGenType type, InstructionHandle start, InstructionHandle end)
Generate a local variable that with index `slot'. Note that double and long variables need two slots. Slot indices have to be provided by the user.
Parameters:
slot - index of local variable
name - its name
type - its type
start - from where the instruction is valid (null means from the start)
end - until where the instruction is valid (null means to the end)
Method Detail

getEnd

public InstructionHandle getEnd()

getLocalVariable

public LocalVariable getLocalVariable(InstructionList il, ConstantPoolGen cp)
Get LocalVariable object. If `start' is null it is set to the start of the method, accordingly `end' points to the end of the instruction list if it was null. 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.
Parameters:
il - instruction list (byte code) which this variable belongs to
cp - constant pool

getName

public String getName()

getSlot

public int getSlot()

getStart

public InstructionHandle getStart()

getType

public ClassGenType getType()

setEnd

public void setEnd(InstructionHandle end)

setName

public void setName(String name)

setSlot

public void setSlot(int slot)

setStart

public void setStart(InstructionHandle start)

setType

public void setType(ClassGenType type)

Association Links

to Class java.lang.String

to Class jellyj.classfile.classgen.ClassGenType

to Class jellyj.classfile.classgen.InstructionHandle

to Class jellyj.classfile.classgen.ConstantPoolGen