jef.dna.constantInfo.impl
Class ConstantAncestor

java.lang.Object
  extended by jef.dna.constantInfo.impl.ConstantAncestor
All Implemented Interfaces:
java.lang.Cloneable, ConstantInfo
Direct Known Subclasses:
ConstantClass, ConstantDouble, ConstantField, ConstantFloat, ConstantInteger, ConstantLong, ConstantNameAndType, ConstantString, ConstantUtf8, UnusableCPTEntry

public abstract class ConstantAncestor
extends java.lang.Object
implements ConstantInfo

Abstract class, ancestor for the other concrete implementation classes.

Author:
Francesco Russo frusso@cs.unibo.it

Field Summary
protected static java.lang.String className
           
protected  ConstantPoolTable cpt
           
protected static Logger logger
           
protected  int tag
           
protected  java.lang.String type
           
 
Constructor Summary
ConstantAncestor()
          Creates a new instance of ConstantAncestor
 
Method Summary
 java.lang.Object clone()
          The clone() method will return a new instance whose reference to the containing ConstantPoolTable instance is left unmodified.
abstract  void fromStream(java.io.DataInputStream dis)
          This method does not perform anything.
 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.
protected abstract  void innerValidations(ConstantPoolTable cpt)
           
 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
abstract  void toStream(java.io.DataOutputStream dos)
          This method does not perform anything.
 void updateRefs(int offset)
          This method does not perform anything.
 boolean validate()
          This method has to perform a validation process over the ConstantInfo according to what specified by the JVM Official Specification.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

className

protected static java.lang.String className

logger

protected static Logger logger

tag

protected int tag

cpt

protected ConstantPoolTable cpt

type

protected java.lang.String type
Constructor Detail

ConstantAncestor

public ConstantAncestor()
Creates a new instance of ConstantAncestor

Method Detail

getTag

public int getTag()
Description copied from interface: ConstantInfo
Gets the unique tag identifing each Constant Info structure

Specified by:
getTag in interface ConstantInfo
Returns:
int The unique tag (see JVM Specification for details)

setTag

public void setTag(int tag)
Description copied from interface: ConstantInfo
Sets the unique tag identifing each Constant Info structure

Specified by:
setTag in interface ConstantInfo
Parameters:
tag - The unique tag (see JVM Specification for details)

fromStream

public abstract void fromStream(java.io.DataInputStream dis)
                         throws DnaDeserializationException
This method does not perform anything. Implementation subclasses have to provide their own implementation.

Specified by:
fromStream in interface ConstantInfo
Parameters:
dis -
Throws:
DnaDeserializationException

toStream

public abstract void toStream(java.io.DataOutputStream dos)
                       throws DnaSerializationException
This method does not perform anything. Implementation subclasses have to provide their own implementation.

Specified by:
toStream in interface ConstantInfo
Parameters:
dos -
Throws:
DnaSerializationException

updateRefs

public void updateRefs(int offset)
This method does not perform anything. Implementation subclasses have to provide their own implementation.

Specified by:
updateRefs in interface ConstantInfo
Parameters:
offset - The offset to be applied

getCpt

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

Specified by:
getCpt in interface ConstantInfo
Returns:
ConstantPoolTable The ConstantPoolTable

setCpt

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

Specified by:
setCpt in interface ConstantInfo
Parameters:
cpt - The ConstantPoolTable

validate

public 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.

Specified by:
validate in interface ConstantInfo
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

innerValidations

protected abstract void innerValidations(ConstantPoolTable cpt)
                                  throws ConstantInfoValidationException,
                                         ConstantInfoAttributeOutOfRangeException
Throws:
ConstantInfoValidationException
ConstantInfoAttributeOutOfRangeException

getType

public java.lang.String getType()
Description copied from interface: ConstantInfo
Return the String identifying the CONSTANT_info data structure.

Specified by:
getType in interface ConstantInfo
Returns:
String The type of CONSTANT_info

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
The clone() method will return a new instance whose reference to the containing ConstantPoolTable instance is left unmodified.

Specified by:
clone in interface ConstantInfo
Overrides:
clone in class java.lang.Object
Returns:
The clone
Throws:
java.lang.CloneNotSupportedException