jef.dna.infoStructures
Interface InfoStructure

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
FieldInfoStructure, MethodInfoStructure
All Known Implementing Classes:
FieldInfo, InfoStructureAncestor, MethodInfo

public interface InfoStructure
extends java.lang.Cloneable

This class gathers all the methods common to both the MethodInfoStructure and the FielsInfoStructure interfaces.

Author:
Francesco Russo frusso@cs.unibo.it

Method Summary
 java.lang.Object clone()
          This method will clone all the current Field/MethodInfoStructure's inner properties but the reference the containing Dna instance.
 void fromStream(java.io.DataInputStream dis, Dna dna)
          Initialize the current InfoStructure from the provided stream.
 int getAccessFlags()
          Get the method's access flags defining which access modifiers are applied to the current method.
 int getAttributeCount()
          Get the number of the additional attributes of the current method.
 java.util.List<Attribute> getAttributes()
          Instances contained within the input List have to be valid implementations of the interfaces defined in the package dna.attributes.
 int getDescriptorIndex()
          Set a valid index pointing to a constant pool table's entry of type ConstantUtf8 representing the description of the current method.
 Dna getDna()
          Get a reference to the Dna instance this infoStructure entity belongs to.
 int getNameIndex()
          Set a valid index pointing to a constant pool table's entry of type ConstantUtf8.
 void setAccessFlags(int accessFlags)
          Set the method's access flags defining which access modifiers are applied to the current method
 void setAttributeCount(int count)
          Set the number of the additional attributes of the current method.
 void setAttributes(java.util.List<Attribute> attributes)
          Instances contained within the input List have to be valid implementations of the interfaces defined in the package dna.attributes.
 void setDescriptorIndex(int index)
          Set a valid index pointing to a constant pool table's entry of type ConstantUtf8 representing the description of the current method.
 void setDna(Dna dnaContainer)
          Set a reference to the Dna instance this infoStructure entity belongs to.
 void setNameIndex(int nameIndex)
          Set a valid index pointing to constant pool table's entry of type ConstantUtf8.
 void toStream(java.io.DataOutputStream dos)
          Serialize the InfoStructure to a stream.
 void updateRefs(int offset)
          This method reorganizes all the references to constant pool table entries
 boolean validate()
          This method has to perform a validation process over the FieldInfo according to what specified by the JVM Official Specification.
 

Method Detail

setNameIndex

void setNameIndex(int nameIndex)
Set a valid index pointing to constant pool table's entry of type ConstantUtf8. This entry has to represent either one of the special method names , or a valid method name in the Java progr. language.

Parameters:
nameIndex - The index pointin to a constant pool table entry

getNameIndex

int getNameIndex()
Set a valid index pointing to a constant pool table's entry of type ConstantUtf8. This entry has to represent either one of the special method names , or a valid method name in the Java progr. language.

Returns:
int The index pointin to a constant pool table entry

setAccessFlags

void setAccessFlags(int accessFlags)
Set the method's access flags defining which access modifiers are applied to the current method

Parameters:
accessFlags - The mask of flags as defined by the Java VM Specification section 4.6

getAccessFlags

int getAccessFlags()
Get the method's access flags defining which access modifiers are applied to the current method.

Returns:
int The mask of flags as defined by the Java VM Specification section 4.6

setDescriptorIndex

void setDescriptorIndex(int index)
Set a valid index pointing to a constant pool table's entry of type ConstantUtf8 representing the description of the current method.

Parameters:
index - A valid index as described above

getDescriptorIndex

int getDescriptorIndex()
Set a valid index pointing to a constant pool table's entry of type ConstantUtf8 representing the description of the current method.

Returns:
int A valid index as described above

setAttributeCount

void setAttributeCount(int count)
Set the number of the additional attributes of the current method.

Parameters:
count - The number of this method's attributes

getAttributeCount

int getAttributeCount()
Get the number of the additional attributes of the current method.

Returns:
int The number of this method's attributes

setAttributes

void setAttributes(java.util.List<Attribute> attributes)
Instances contained within the input List have to be valid implementations of the interfaces defined in the package dna.attributes.

Parameters:
attributes - The attributes associated with the current method

getAttributes

java.util.List<Attribute> getAttributes()
Instances contained within the input List have to be valid implementations of the interfaces defined in the package dna.attributes.

Returns:
List The attributes associated with the current method

updateRefs

void updateRefs(int offset)
This method reorganizes all the references to constant pool table entries

Parameters:
offset - offset

setDna

void setDna(Dna dnaContainer)
Set a reference to the Dna instance this infoStructure entity belongs to.

Parameters:
dna - The Dna "container"

getDna

Dna getDna()
Get a reference to the Dna instance this infoStructure entity belongs to.

Returns:
Dna The Dna "container"

validate

boolean validate()
                 throws FieldInfoValidationException,
                        InfoStructureAttributeOutOfRangeException,
                        MissingDnaContainerException,
                        MissingCPTableException
This method has to perform a validation process over the FieldInfo according to what specified by the JVM Official Specification.

Throws:
FieldInfoValidationException - Something failed with the validation process; further information are stored within the raised exception. This exception might be a FieldInfo|MethodInfo|AttributeInfoValidationException
InfoStructureAttributeOutOfRangeException - The InfoStructure contains some attribute pointing to an invalid index of the Constant Pool Table
MissingDnaContainerException - The validation process cannot be accomplished since any of the examined entities is missing its own Dna container
MissingCPTableException - The validation process cannot be accomplished since there is no reference to the ConstantPoolTable in the current Dna instance

toStream

void toStream(java.io.DataOutputStream dos)
              throws DnaSerializationException
Serialize the InfoStructure to a stream.

Parameters:
dos - The output stream to write to
Throws:
DnaSerializationException

fromStream

void fromStream(java.io.DataInputStream dis,
                Dna dna)
                throws DnaDeserializationException,
                       MissingDnaContainerException
Initialize the current InfoStructure from the provided stream. The provided Dna instance, if not null, will replace the one set by a formerly invoked setDna() method. Otherwise, should the both the provided Dna instance and the one set by the setDna method be null, this method will throw a MissingDnaContainerException.

Parameters:
dis - The input stream the InfoStructure should be read from
dna - The Dna instance which will contain this InfoStructure instance
Throws:
DnaDeserializationException
MissingDnaContainerException

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
This method will clone all the current Field/MethodInfoStructure's inner properties but the reference the containing Dna instance.

Throws:
java.lang.CloneNotSupportedException