jef.dna.attributes.impl
Class LocalVariableTableEntry

java.lang.Object
  extended by jef.dna.attributes.impl.LocalVariableTableEntry
All Implemented Interfaces:
java.lang.Cloneable, LocalVariableTableEntry, BytesCountable

public class LocalVariableTableEntry
extends java.lang.Object
implements LocalVariableTableEntry

Class representing a Local Variable instance's table entry.

Author:
Francesco Russo

Field Summary
protected static Logger logger
           
 
Constructor Summary
LocalVariableTableEntry()
          Creates a new instance of LocalVariableTableEntry
 
Method Summary
 java.lang.Object clone()
          The clone() method will return a new instance whose reference to the containing LocalVariableTableAttribute is not modified.
 void fromStream(java.io.DataInputStream dis)
          Deserializes the given local variable table entry from the provided input stream.
 LocalVariableTableAttribute getAttributeContainer()
          Set the reference to the LocalVariableTableAttribute containing the current LocalVariableTableEntry.
 int getBytesCount()
          This method must return the overall number of bytes required by the component implementing this interface.
 int getDescriptorIndex()
          The value of the descriptor_index item must be a valid index into the constant_pool table.
 int getIndex()
          The given local variable must be at index in the local variable array of the current frame.
 int getLength()
          Returns the current value of length
 int getNameIndex()
          The value of the name_index item must be a valid index into the constant_pool table.
 int getStartPc()
          Returns the current value of the startPc
 void setAttributeContainer(LocalVariableTableAttribute attribute)
          Set the reference to the LocalVariableTableAttribute containing the current LocalVariableTableEntry.
 void setDescriptorIndex(int descIndex)
          The value of the descriptor_index item must be a valid index into the constant_pool table.
 void setIndex(int index)
          The given local variable must be at index in the local variable array of the current frame.
 void setLength(int length)
          The given local variable must have a value at indices into the code array in the interval [start_pc, start_pc+length], that is, between start_pc and start_pc+length inclusive.
 void setNameIndex(int nameIndex)
          The value of the name_index item must be a valid index into the constant_pool table.
 void setStartPc(int startPc)
          The given local variable must have a value at indices into the code array in the interval [start_pc, start_pc+length], that is, between start_pc and start_pc+length inclusive.
 void toStream(java.io.DataOutputStream dos)
          Serializes the given local variable table entry to the provided output stream.
 void updateRefs(int offset)
          Updates all the references to entries into the constant pool table by the given offset
 void validate()
          Perform validation over the current LocalVariableTableEntry
protected  void validateDescriptorIndex()
           
protected  void validateIndex()
           
protected  void validateLength()
           
protected  void validateNameIndex()
           
protected  void validateStartPc()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static Logger logger
Constructor Detail

LocalVariableTableEntry

public LocalVariableTableEntry()
Creates a new instance of LocalVariableTableEntry

Method Detail

setStartPc

public void setStartPc(int startPc)
Description copied from interface: LocalVariableTableEntry
The given local variable must have a value at indices into the code array in the interval [start_pc, start_pc+length], that is, between start_pc and start_pc+length inclusive. The value of start_pc must be a valid index into the code array of this Code attribute and must be the index of the opcode of an instruction. Either the value of start_pc+length must be a valid index into the code array of this Code attribute and be the index of the opcode of an instruction, or it must be the first index beyond the end of that code array

Specified by:
setStartPc in interface LocalVariableTableEntry
Parameters:
startPc - The value of the startPc

getStartPc

public int getStartPc()
Description copied from interface: LocalVariableTableEntry
Returns the current value of the startPc

Specified by:
getStartPc in interface LocalVariableTableEntry
Returns:
int The value of the startPc

setLength

public void setLength(int length)
Description copied from interface: LocalVariableTableEntry
The given local variable must have a value at indices into the code array in the interval [start_pc, start_pc+length], that is, between start_pc and start_pc+length inclusive. The value of start_pc must be a valid index into the code array of this Code attribute and must be the index of the opcode of an instruction. Either the value of start_pc+length must be a valid index into the code array of this Code attribute and be the index of the opcode of an instruction, or it must be the first index beyond the end of that code array

Specified by:
setLength in interface LocalVariableTableEntry
Parameters:
length - The value of length

getLength

public int getLength()
Description copied from interface: LocalVariableTableEntry
Returns the current value of length

Specified by:
getLength in interface LocalVariableTableEntry
Returns:
int The value of length

setNameIndex

public void setNameIndex(int nameIndex)
Description copied from interface: LocalVariableTableEntry
The value of the name_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must contain a CONSTANT_Utf8_info structure representing a valid local variable name stored as a simple name.

Specified by:
setNameIndex in interface LocalVariableTableEntry
Parameters:
nameIndex - A valid index into the constant pool table as defined above

getNameIndex

public int getNameIndex()
Description copied from interface: LocalVariableTableEntry
The value of the name_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must contain a CONSTANT_Utf8_info structure representing a valid local variable name stored as a simple name.

Specified by:
getNameIndex in interface LocalVariableTableEntry
Returns:
int A valid index into the constant pool table as defined above

setDescriptorIndex

public void setDescriptorIndex(int descIndex)
Description copied from interface: LocalVariableTableEntry
The value of the descriptor_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must contain a CONSTANT_Utf8_info structure representing a field descriptor encoding the type of a local variable in the source program.

Specified by:
setDescriptorIndex in interface LocalVariableTableEntry
Parameters:
descIndex - A valid index into tha constant pool table as defined above

getDescriptorIndex

public int getDescriptorIndex()
Description copied from interface: LocalVariableTableEntry
The value of the descriptor_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must contain a CONSTANT_Utf8_info structure representing a field descriptor encoding the type of a local variable in the source program.

Specified by:
getDescriptorIndex in interface LocalVariableTableEntry
Returns:
int A valid index into tha constant pool table as defined above

setIndex

public void setIndex(int index)
Description copied from interface: LocalVariableTableEntry
The given local variable must be at index in the local variable array of the current frame. If the local variable at index is of type double or long, it occupies both index and index+1.

Specified by:
setIndex in interface LocalVariableTableEntry
Parameters:
index - A valid index as described above

getIndex

public int getIndex()
Description copied from interface: LocalVariableTableEntry
The given local variable must be at index in the local variable array of the current frame. If the local variable at index is of type double or long, it occupies both index and index+1.

Specified by:
getIndex in interface LocalVariableTableEntry
Returns:
int A valid index as described above

setAttributeContainer

public void setAttributeContainer(LocalVariableTableAttribute attribute)
Description copied from interface: LocalVariableTableEntry
Set the reference to the LocalVariableTableAttribute containing the current LocalVariableTableEntry.

Specified by:
setAttributeContainer in interface LocalVariableTableEntry
Parameters:
attribute - The container

getAttributeContainer

public LocalVariableTableAttribute getAttributeContainer()
Description copied from interface: LocalVariableTableEntry
Set the reference to the LocalVariableTableAttribute containing the current LocalVariableTableEntry.

Specified by:
getAttributeContainer in interface LocalVariableTableEntry
Returns:
LocalVariableTableAttribute The container

toStream

public void toStream(java.io.DataOutputStream dos)
              throws java.io.IOException
Description copied from interface: LocalVariableTableEntry
Serializes the given local variable table entry to the provided output stream.

Specified by:
toStream in interface LocalVariableTableEntry
Parameters:
dos - The stream the current local variable table entry has to be written to
Throws:
java.io.IOException

fromStream

public void fromStream(java.io.DataInputStream dis)
                throws java.io.IOException
Description copied from interface: LocalVariableTableEntry
Deserializes the given local variable table entry from the provided input stream.

Specified by:
fromStream in interface LocalVariableTableEntry
Parameters:
dis - The stream the current local variable table entry has to be read from
Throws:
java.io.IOException

updateRefs

public void updateRefs(int offset)
Description copied from interface: LocalVariableTableEntry
Updates all the references to entries into the constant pool table by the given offset

Specified by:
updateRefs in interface LocalVariableTableEntry
Parameters:
offset - The offset for performing the update

validate

public void validate()
              throws LocalVariableTableEntryValidationException,
                     MissingDnaContainerException,
                     MissingAttributeContainerException
Description copied from interface: LocalVariableTableEntry
Perform validation over the current LocalVariableTableEntry

Specified by:
validate in interface LocalVariableTableEntry
Throws:
LocalVariableTableEntryValidationException
MissingDnaContainerException
MissingAttributeContainerException

validateStartPc

protected void validateStartPc()
                        throws MissingAttributeContainerException,
                               MissingDnaContainerException,
                               LocalVariableTableEntryValidationException
Throws:
MissingAttributeContainerException
MissingDnaContainerException
LocalVariableTableEntryValidationException

validateLength

protected void validateLength()
                       throws MissingAttributeContainerException,
                              MissingDnaContainerException,
                              LocalVariableTableEntryValidationException
Throws:
MissingAttributeContainerException
MissingDnaContainerException
LocalVariableTableEntryValidationException

validateNameIndex

protected void validateNameIndex()
                          throws LocalVariableTableEntryValidationException,
                                 MissingDnaContainerException,
                                 MissingAttributeContainerException
Throws:
LocalVariableTableEntryValidationException
MissingDnaContainerException
MissingAttributeContainerException

validateDescriptorIndex

protected void validateDescriptorIndex()
                                throws LocalVariableTableEntryValidationException,
                                       MissingDnaContainerException,
                                       MissingAttributeContainerException
Throws:
LocalVariableTableEntryValidationException
MissingDnaContainerException
MissingAttributeContainerException

validateIndex

protected void validateIndex()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
The clone() method will return a new instance whose reference to the containing LocalVariableTableAttribute is not modified.

Specified by:
clone in interface LocalVariableTableEntry
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getBytesCount

public int getBytesCount()
Description copied from interface: BytesCountable
This method must return the overall number of bytes required by the component implementing this interface.

Specified by:
getBytesCount in interface BytesCountable