jef.dna.constantInfo
Interface ConstantInfo

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
ConstClass, ConstDouble, ConstField, ConstFloat, ConstInteger, ConstInterfaceMethod, ConstLong, ConstMethod, ConstNameAndType, ConstString, ConstUtf8, UnusableEntry
All Known Implementing Classes:
ConstantAncestor, ConstantClass, ConstantDouble, ConstantField, ConstantFloat, ConstantInteger, ConstantInterfaceMethod, ConstantLong, ConstantMethod, ConstantNameAndType, ConstantString, ConstantUtf8, UnusableCPTEntry

public interface ConstantInfo
extends java.lang.Cloneable

This interface defines the basic method every Constant Info class has to implement

Author:
frusso

Method Summary
 java.lang.Object clone()
          Clones the current ConstantInfo.
 void fromStream(java.io.DataInputStream dis)
          Reads the Constant Info fields from the given input stream
 ConstantPoolTable getCpt()
          Get a reference to the ConstantPoolTable instance this constantInfo entity belongs to.
 int getTag()
          Gets the unique tag identifing each Constant Info structure
 java.lang.String getType()
          Return the String identifying the CONSTANT_info data structure.
 void setCpt(ConstantPoolTable cpt)
          Set a reference to the ConstantPoolTable instance this constantInfo entity belongs to.
 void setTag(int tag)
          Sets the unique tag identifing each Constant Info structure
 void toStream(java.io.DataOutputStream dos)
          Writes to the given output stream the ConstantInfo object
 void updateRefs(int offset)
          Update all the references to entries in the constant pool table by adding the specified offset.
 boolean validate()
          This method has to perform a validation process over the ConstantInfo according to what specified by the JVM Official Specification.
 

Method Detail

setTag

void setTag(int tag)
Sets the unique tag identifing each Constant Info structure

Parameters:
tag - The unique tag (see JVM Specification for details)

getTag

int getTag()
Gets the unique tag identifing each Constant Info structure

Returns:
int The unique tag (see JVM Specification for details)

updateRefs

void updateRefs(int offset)
Update all the references to entries in the constant pool table by adding the specified offset.

Parameters:
offset - The offset to be applied

setCpt

void setCpt(ConstantPoolTable cpt)
Set a reference to the ConstantPoolTable instance this constantInfo entity belongs to.

Parameters:
cpt - The ConstantPoolTable

getCpt

ConstantPoolTable getCpt()
Get a reference to the ConstantPoolTable instance this constantInfo entity belongs to.

Returns:
ConstantPoolTable The ConstantPoolTable

getType

java.lang.String getType()
Return the String identifying the CONSTANT_info data structure.

Returns:
String The type of CONSTANT_info

validate

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

Throws:
ConstantInfoValidationException - Something failed with the validation process; further information are stored within the raised exception
ConstantInfoAttributeOutOfRangeException - This exception is thrown when a ConstantInfo contains a reference to an invalid Constant Pool Table entry
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

fromStream

void fromStream(java.io.DataInputStream dis)
                throws DnaDeserializationException
Reads the Constant Info fields from the given input stream

Parameters:
dis - The DataInputStream for reading the Constant Info fields
Throws:
DnaDeserializationException

toStream

void toStream(java.io.DataOutputStream dos)
              throws DnaSerializationException
Writes to the given output stream the ConstantInfo object

Parameters:
dos - The DataOutputStream to write the object to
Throws:
DnaSerializationException

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones the current ConstantInfo.

Returns:
The clone
Throws:
java.lang.CloneNotSupportedException