javassist.bytecode
Class LocalVariableAttribute

java.lang.Object
  extended by javassist.bytecode.AttributeInfo
      extended by javassist.bytecode.LocalVariableAttribute
Direct Known Subclasses:
LocalVariableTypeAttribute

public class LocalVariableAttribute
extends AttributeInfo

LocalVariableTable_attribute.


Field Summary
static java.lang.String tag
          The name of this attribute "LocalVariableTable".
static java.lang.String typeTag
          The name of the attribute "LocalVariableTypeTable".
 
Fields inherited from class javassist.bytecode.AttributeInfo
constPool
 
Constructor Summary
LocalVariableAttribute(ConstPool cp)
          Constructs an empty LocalVariableTable.
LocalVariableAttribute(ConstPool cp, java.lang.String name)
          Deprecated.  
 
Method Summary
 void addEntry(int startPc, int length, int nameIndex, int descriptorIndex, int index)
          Appends a new entry to local_variable_table.
 int codeLength(int i)
          Returns local_variable_table[i].length.
 AttributeInfo copy(ConstPool newCp, java.util.Map classnames)
          Makes a copy.
 java.lang.String descriptor(int i)
          Returns the type descriptor of the local variable specified by local_variable_table[i].descriptor_index.
 int descriptorIndex(int i)
          Returns the value of local_variable_table[i].descriptor_index.
 int index(int i)
          Returns local_variable_table[i].index.
 int nameIndex(int i)
          Returns the value of local_variable_table[i].name_index.
 void shiftIndex(int lessThan, int delta)
          For each local_variable_table[i].index, this method increases index by delta.
 java.lang.String signature(int i)
          This method is equivalent to descriptor().
 int signatureIndex(int i)
          This method is equivalent to descriptorIndex().
 int startPc(int i)
          Returns local_variable_table[i].start_pc.
 int tableLength()
          Returns local_variable_table_length.
 java.lang.String variableName(int i)
          Returns the name of the local variable specified by local_variable_table[i].name_index.
 
Methods inherited from class javassist.bytecode.AttributeInfo
get, getConstPool, getName, length, set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tag

public static final java.lang.String tag
The name of this attribute "LocalVariableTable".

See Also:
Constant Field Values

typeTag

public static final java.lang.String typeTag
The name of the attribute "LocalVariableTypeTable".

See Also:
Constant Field Values
Constructor Detail

LocalVariableAttribute

public LocalVariableAttribute(ConstPool cp)
Constructs an empty LocalVariableTable.


LocalVariableAttribute

public LocalVariableAttribute(ConstPool cp,
                              java.lang.String name)
Deprecated. 

Constructs an empty LocalVariableTable.

Parameters:
name - the attribute name. LocalVariableAttribute.tag or LocalVariableAttribute.typeTag.
Since:
3.1
See Also:
tag, typeTag
Method Detail

addEntry

public void addEntry(int startPc,
                     int length,
                     int nameIndex,
                     int descriptorIndex,
                     int index)
Appends a new entry to local_variable_table.

Parameters:
startPc - start_pc
length - length
nameIndex - name_index
descriptorIndex - descriptor_index
index - index

shiftIndex

public void shiftIndex(int lessThan,
                       int delta)
For each local_variable_table[i].index, this method increases index by delta.

Parameters:
lessThan - the index does not change if it is less than this value.

tableLength

public int tableLength()
Returns local_variable_table_length. This represents the number of entries in the table.


startPc

public int startPc(int i)
Returns local_variable_table[i].start_pc. This represents the index into the code array from which the local variable is effective.

Parameters:
i - the i-th entry.

codeLength

public int codeLength(int i)
Returns local_variable_table[i].length. This represents the length of the code region in which the local variable is effective.

Parameters:
i - the i-th entry.

nameIndex

public int nameIndex(int i)
Returns the value of local_variable_table[i].name_index. This represents the name of the local variable.

Parameters:
i - the i-th entry.

variableName

public java.lang.String variableName(int i)
Returns the name of the local variable specified by local_variable_table[i].name_index.

Parameters:
i - the i-th entry.

descriptorIndex

public int descriptorIndex(int i)
Returns the value of local_variable_table[i].descriptor_index. This represents the type descriptor of the local variable.

If this attribute represents a LocalVariableTypeTable attribute, this method returns the value of local_variable_type_table[i].signature_index. It represents the type of the local variable.

Parameters:
i - the i-th entry.

signatureIndex

public int signatureIndex(int i)
This method is equivalent to descriptorIndex(). If this attribute represents a LocalVariableTypeTable attribute, this method should be used instead of descriptorIndex() since the method name is more appropriate.

Parameters:
i - the i-th entry.
See Also:
descriptorIndex(int), SignatureAttribute.toFieldSignature(String)

descriptor

public java.lang.String descriptor(int i)
Returns the type descriptor of the local variable specified by local_variable_table[i].descriptor_index.

If this attribute represents a LocalVariableTypeTable attribute, this method returns the type signature of the local variable specified by local_variable_type_table[i].signature_index.

Parameters:
i - the i-th entry.

signature

public java.lang.String signature(int i)
This method is equivalent to descriptor(). If this attribute represents a LocalVariableTypeTable attribute, this method should be used instead of descriptor() since the method name is more appropriate.

To parse the string, call toFieldSignature(String) in SignatureAttribute.

Parameters:
i - the i-th entry.
See Also:
descriptor(int), SignatureAttribute.toFieldSignature(String)

index

public int index(int i)
Returns local_variable_table[i].index. This represents the index of the local variable.

Parameters:
i - the i-th entry.

copy

public AttributeInfo copy(ConstPool newCp,
                          java.util.Map classnames)
Makes a copy.

Overrides:
copy in class AttributeInfo
Parameters:
newCp - the constant pool table used by the new copy.
classnames - should be null.


Copyright © 2011. All Rights Reserved.