jef.dna.attributes.impl
Class LocalVariableTableAttribute

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

@ContainedInCodeAttribute(containerPropertyName="attributeContainer")
public class LocalVariableTableAttribute
extends GenericAttribute
implements LocalVariableTableAttribute

Class representing a Local Variable Table Attribute.

Author:
Francesco Russo frusso@cs.unibo.it

Field Summary
protected static Logger logger
           
 
Fields inherited from class jef.dna.attributes.impl.GenericAttribute
attribFactory, attributeNameIndex, dna, instrFactory, length
 
Constructor Summary
LocalVariableTableAttribute()
          Creates a new instance of LocalVariableTableAttribute
 
Method Summary
 java.lang.Object clone()
          The clone() method will return a new instance whose reference to the containing CodeAttribute is not modified.
 void fromStream(java.io.DataInputStream dis, Dna dna, int indexName, int length)
          This method reads the data with which the attribute has to be initialized.
 CodeAttribute getAttributeContainer()
          Get the reference to the CodeAttribute containing the current LocalVariableTableAttribute.
 int getBytesCount()
          This method must return the overall number of bytes required by the component implementing this interface.
 java.util.List<LocalVariableTableEntry> getLocalVariableTable()
          Each entry in the local_variable_table array indicates a range of code array offsets within which a local variable has a value.
 int getLocalVariableTableLength()
          The value of the local_variable_table_length item indicates the number of entries in the local_variable_table array.
protected  void innerValidations(ConstantPoolTable cpt)
           
 void setAttributeContainer(CodeAttribute attribute)
          Set the reference to the CodeAttribute containing the current LocalVariableTableAttribute.
 void setLocalVariableTable(java.util.List<LocalVariableTableEntry> table)
           
 void toStream(java.io.DataOutputStream dos)
          This method writes the attribute to the provided output stream.
 void updateRefs(int offset)
          This method updates all the references pointing to constant pool table's entries this attributes holds.
 
Methods inherited from class jef.dna.attributes.impl.GenericAttribute
getDna, getLength, getNameIndex, setDna, setNameIndex, validate, validateNameIndex
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jef.dna.attributes.Attribute
getDna, getLength, getNameIndex, setDna, setNameIndex, validate
 

Field Detail

logger

protected static Logger logger
Constructor Detail

LocalVariableTableAttribute

public LocalVariableTableAttribute()
Creates a new instance of LocalVariableTableAttribute

Method Detail

getLocalVariableTableLength

public int getLocalVariableTableLength()
Description copied from interface: LocalVariableTableAttribute
The value of the local_variable_table_length item indicates the number of entries in the local_variable_table array.

Specified by:
getLocalVariableTableLength in interface LocalVariableTableAttribute
Returns:
int The dimension of the local variable table

setLocalVariableTable

public void setLocalVariableTable(java.util.List<LocalVariableTableEntry> table)

getLocalVariableTable

public java.util.List<LocalVariableTableEntry> getLocalVariableTable()
Description copied from interface: LocalVariableTableAttribute
Each entry in the local_variable_table array indicates a range of code array offsets within which a local variable has a value. It also indicates the index into the local variable array of the current frame at which that local variable can be found.

Specified by:
getLocalVariableTable in interface LocalVariableTableAttribute
Returns:
List The local variable table shaped as a List storing LocalVariableTableEntry instances

setAttributeContainer

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

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

getAttributeContainer

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

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

toStream

public void toStream(java.io.DataOutputStream dos)
              throws DnaSerializationException
Description copied from interface: Attribute
This method writes the attribute to the provided output stream.

Specified by:
toStream in interface Attribute
Parameters:
dos - The output stream
Throws:
DnaSerializationException - Errors while writing the attribute to the output stream

fromStream

public void fromStream(java.io.DataInputStream dis,
                       Dna dna,
                       int indexName,
                       int length)
                throws DnaDeserializationException,
                       MissingDnaContainerException
Description copied from interface: Attribute
This method reads the data with which the attribute has to be initialized.

Specified by:
fromStream in interface Attribute
Parameters:
dis - The input stream
dna - The Dna instance this class belongs to
indexName - The value of the name index
length - The length of the attribute
Throws:
DnaDeserializationException - Errors while reading the attribute from the stream
MissingDnaContainerException - There is no reference to the current Dna container

updateRefs

public void updateRefs(int offset)
Description copied from interface: Attribute
This method updates all the references pointing to constant pool table's entries this attributes holds.

Specified by:
updateRefs in interface Attribute
Specified by:
updateRefs in class GenericAttribute
Parameters:
offset - The offset

innerValidations

protected void innerValidations(ConstantPoolTable cpt)
                         throws AttributeValidationException,
                                AttributeOutOfRangeException,
                                MissingDnaContainerException,
                                MissingCPTableException
Overrides:
innerValidations in class GenericAttribute
Throws:
AttributeValidationException
AttributeOutOfRangeException
MissingDnaContainerException
MissingCPTableException

clone

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

Specified by:
clone in interface Attribute
Overrides:
clone in class GenericAttribute
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