jef.dna.attributes.impl
Class EnclosingMethod

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

public class EnclosingMethod
extends GenericAttribute
implements EnclosingMethodAttribute

Author:
frusso

Field Summary
 
Fields inherited from class jef.dna.attributes.impl.GenericAttribute
attribFactory, attributeNameIndex, className, dna, instrFactory, length, logger
 
Constructor Summary
EnclosingMethod()
          Creates a new instance of EnclosingMethod
 
Method Summary
 java.lang.Object clone()
          The clone() method will return a new instance whose reference to the containing Dna instance is set to null.
 void fromStream(java.io.DataInputStream dis, Dna dna, int nameIndex, int length)
          This method reads the data with which the attribute has to be initialized.
 int getBytesCount()
          This method must return the overall number of bytes required by the component implementing this interface.
 int getClassIndex()
          Thevalue of theclass_index item must be a valid index into the constant_pool table.
 int getMethodIndex()
          If the current class is not immediately enclosed by a method or constructor, then the value of themethod_index item must be zero.
protected  void innerValidations(ConstantPoolTable cpt)
           
 void setClassIndex(int cIndx)
          Thevalue of theclass_index item must be a valid index into the constant_pool table.
 void setMethodIndex(int mIndx)
          If the current class is not immediately enclosed by a method or constructor, then the value of themethod_index item must be zero.
 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
 

Constructor Detail

EnclosingMethod

public EnclosingMethod()
Creates a new instance of EnclosingMethod

Method Detail

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

fromStream

public void fromStream(java.io.DataInputStream dis,
                       Dna dna,
                       int nameIndex,
                       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
nameIndex - 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

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

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
The clone() method will return a new instance whose reference to the containing Dna instance is set to null. It is up to you appropriately setting it to the correct value.

Specified by:
clone in interface Attribute
Overrides:
clone in class GenericAttribute
Throws:
java.lang.CloneNotSupportedException

innerValidations

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

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

setClassIndex

public void setClassIndex(int cIndx)
Description copied from interface: EnclosingMethodAttribute
Thevalue of theclass_index item must be a valid index into the constant_pool table. Theconstant_pool entry at that index mustbea CONSTANT_Class_info (�4.5.1) structure representing the innermost class that encloses the declaration of the current class.

Specified by:
setClassIndex in interface EnclosingMethodAttribute

getClassIndex

public int getClassIndex()
Description copied from interface: EnclosingMethodAttribute
Thevalue of theclass_index item must be a valid index into the constant_pool table. Theconstant_pool entry at that index mustbea CONSTANT_Class_info (�4.5.1) structure representing the innermost class that encloses the declaration of the current class.

Specified by:
getClassIndex in interface EnclosingMethodAttribute

setMethodIndex

public void setMethodIndex(int mIndx)
Description copied from interface: EnclosingMethodAttribute
If the current class is not immediately enclosed by a method or constructor, then the value of themethod_index item must be zero. Otherwise, the value of themethod_index item must be a valid index into theconstant_pool table. Theconstant_pool entry at that index must be a CONSTANT_NameAndType_info (�4.5.6) structure representing the name and type of a method in the class referenced by the class_index attribute above. It is the responsibility of the Java compiler to ensure that the method identified via themethod_index is indeed the closest lexically enclosing method of the class that contains this EnclosingMethod attribute.

Specified by:
setMethodIndex in interface EnclosingMethodAttribute

getMethodIndex

public int getMethodIndex()
Description copied from interface: EnclosingMethodAttribute
If the current class is not immediately enclosed by a method or constructor, then the value of themethod_index item must be zero. Otherwise, the value of themethod_index item must be a valid index into theconstant_pool table. Theconstant_pool entry at that index must be a CONSTANT_NameAndType_info (�4.5.6) structure representing the name and type of a method in the class referenced by the class_index attribute above. It is the responsibility of the Java compiler to ensure that the method identified via themethod_index is indeed the closest lexically enclosing method of the class that contains this EnclosingMethod attribute.

Specified by:
getMethodIndex in interface EnclosingMethodAttribute