org.apache.tomcat.util.bcel.classfile

## Class LocalVariable

- java.lang.Object
- - org.apache.tomcat.util.bcel.classfile.LocalVariable

All Implemented Interfaces:
  Serializable, Cloneable, Constants

    public final class LocalVariable
    extends Object
    implements Constants, Cloneable, Serializable

This class represents a local variable within a method. It contains its scope, name, signature and index on the method's frame.

Author:
  M. Dahm
See Also:
  `LocalVariableTable`, Serialized Form

### Field Summary

### Fields inherited from interface org.apache.tomcat.util.bcel.Constants

`ACC_ABSTRACT, ACC_ANNOTATION, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_SUPER, ACCESS_NAMES, ALOAD, ANEWARRAY, APPEND_FRAME, APPEND_FRAME_MAX, ASTORE, ATTR_ANNOTATION_DEFAULT, ATTR_BOOTSTRAP_METHODS, ATTR_CODE, ATTR_CONSTANT_VALUE, ATTR_DEPRECATED, ATTR_ENCLOSING_METHOD, ATTR_EXCEPTIONS, ATTR_INNER_CLASSES, ATTR_LINE_NUMBER_TABLE, ATTR_LOCAL_VARIABLE_TABLE, ATTR_LOCAL_VARIABLE_TYPE_TABLE, ATTR_METHOD_PARAMETERS, ATTR_PMG, ATTR_RUNTIME_INVISIBLE_ANNOTATIONS, ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS, ATTR_RUNTIME_VISIBLE_ANNOTATIONS, ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS, ATTR_SIGNATURE, ATTR_SOURCE_FILE, ATTR_STACK_MAP, ATTR_STACK_MAP_TABLE, ATTR_SYNTHETIC, ATTR_UNKNOWN, ATTRIBUTE_NAMES, CHECKCAST, CHOP_FRAME, CHOP_FRAME_MAX, CONSTANT_Class, CONSTANT_Double, CONSTANT_Fieldref, CONSTANT_Float, CONSTANT_Integer, CONSTANT_InterfaceMethodref, CONSTANT_InvokeDynamic, CONSTANT_Long, CONSTANT_MethodHandle, CONSTANT_Methodref, CONSTANT_MethodType, CONSTANT_NameAndType, CONSTANT_NAMES, CONSTANT_String, CONSTANT_Utf8, DLOAD, DSTORE, FLOAD, FSTORE, FULL_FRAME, GETFIELD, GETSTATIC, GOTO, GOTO_W, 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, ILLEGAL_OPCODE, ILLEGAL_TYPE, ILOAD, INSTANCEOF, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, ISTORE, ITEM_Bogus, ITEM_NAMES, ITEM_NewObject, ITEM_Object, JSR, JSR_W, KNOWN_ATTRIBUTES, LDC, LDC_W, LDC2_W, LLOAD, LOOKUPSWITCH, LSTORE, MAX_ACC_FLAG, MULTIANEWARRAY, NEW, NEWARRAY, NO_OF_OPERANDS, OPCODE_NAMES, PUTFIELD, PUTSTATIC, RESERVED, RET, SAME_FRAME, SAME_FRAME_EXTENDED, SAME_FRAME_MAX, SAME_LOCALS_1_STACK_ITEM_FRAME, SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED, SAME_LOCALS_1_STACK_ITEM_FRAME_MAX, T_BYTE, T_INT, T_SHORT, T_UNKNOWN, TABLESWITCH, TYPE_NAMES, TYPE_OF_OPERANDS, UNDEFINED, UNPREDICTABLE, WIDE`

### Constructor Summary

Constructors
Constructor and Description
`LocalVariable(int start_pc, int length, int name_index, int signature_index, int index, ConstantPool constant_pool)`

### Method Summary

Methods
`LocalVariable` `copy()`
`void` `dump(DataOutputStream file)` Dump local variable to file stream in binary format.
`int` `getIndex()`
`String` `getName()`
`String` `getSignature()`
`String` `toString()`

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

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

### Constructor Detail

#### LocalVariable

    public LocalVariable(int start_pc,
                 int length,
                 int name_index,
                 int signature_index,
                 int index,
                 ConstantPool constant_pool)

Parameters:
  `start_pc` - Range in which the variable
  `length` - ... is valid
  `name_index` - Index in constant pool of variable name
  `signature_index` - Index of variable's signature
  `index` - Variable is `index'th local variable on the method's frame
  `constant_pool` - Array of constants

### Method Detail

#### dump

    public final void dump(DataOutputStream file)
                    throws IOException

Dump local variable to file stream in binary format.

Parameters:
  `file` - Output file stream
Throws:
  `IOException`

#### getName

    public final String getName()

Returns:
  Variable name.

#### getSignature

    public final String getSignature()

Returns:
  Signature.

#### getIndex

    public final int getIndex()

Returns:
  index of register where variable is stored

#### toString

    public final String toString()

Overrides:
  `toString` in class `Object`
Returns:
  string representation.

#### copy

    public LocalVariable copy()

Returns:
  deep copy of this object