sysModel.classFile.attributes
Class AAttributeInfo

java.lang.Object
  extended by sysModel.classFile.attributes.AAttributeInfo
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
CodeAttributeInfo, SourceFileAttributeInfo, UnknownAttributeInfo

public abstract class AAttributeInfo
extends java.lang.Object
implements java.lang.Cloneable

Abstract class file attribute.

Author:
Mathias Ricken

Field Summary
protected  ConstantPool _constantPool
          Constant pool.
protected  byte[] _data
          Attribute _data.
private static java.lang.Class[] _knownAttributes
          Array with registered attributes.
protected  AUTFPoolInfo _name
          Attribute _name information.
 
Constructor Summary
AAttributeInfo(AUTFPoolInfo name, byte[] data, ConstantPool cp)
          Constructor.
 
Method Summary
abstract  void adjustPC(short startPC, short deltaPC)
          Adjust program counter values contained in this attribute, starting at startPC, by adding deltaPC to them.
abstract
<R,D> R
execute(IAttributeVisitor<R,D> visitor, D param)
          Execute a visitor on this attribute.
 byte[] getData()
          Accessor for data.
 AUTFPoolInfo getName()
          Accessor for _name information.
 java.lang.Object lone()
          Creates and returns a copy of this object.
static AAttributeInfo read(java.io.DataInputStream di, ConstantPool pool)
          Read from stream and return unresolved constant pool object.
 void setData(byte[] data)
          Mutator for data.
 void setName(AUTFPoolInfo name)
          Mutator for _name information.
 java.lang.String toString()
          Return a human-readable version of this attribute.
abstract  void translatePC(short index, short deltaIndex, LineNumberTable oldLnt, LineNumberTable newLnt)
          Translate the program counter values contained in this attribute from an old line number table to a new one.
 void write(java.io.DataOutputStream dos)
          Write this attribute into a stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_name

protected AUTFPoolInfo _name
Attribute _name information.


_data

protected byte[] _data
Attribute _data.


_constantPool

protected ConstantPool _constantPool
Constant pool.


_knownAttributes

private static java.lang.Class[] _knownAttributes
Array with registered attributes.

Constructor Detail

AAttributeInfo

public AAttributeInfo(AUTFPoolInfo name,
                      byte[] data,
                      ConstantPool cp)
Constructor.

Parameters:
name - attrobite name
data - attribute data
cp - constant pool
Method Detail

read

public static AAttributeInfo read(java.io.DataInputStream di,
                                  ConstantPool pool)
                           throws java.io.IOException,
                                  java.lang.ClassFormatError
Read from stream and return unresolved constant pool object.

Parameters:
di - stream
pool - constant pool
Returns:
attribute
Throws:
java.io.IOException
java.lang.ClassFormatError

getName

public AUTFPoolInfo getName()
Accessor for _name information.

Returns:
_name information

setName

public void setName(AUTFPoolInfo name)
Mutator for _name information.

Parameters:
name - _name information

getData

public byte[] getData()
Accessor for data.

Returns:
data data

setData

public void setData(byte[] data)
Mutator for data.

Parameters:
data - data

write

public void write(java.io.DataOutputStream dos)
           throws java.io.IOException
Write this attribute into a stream

Parameters:
dos - output stream
Throws:
java.io.IOException

toString

public java.lang.String toString()
Return a human-readable version of this attribute.

Overrides:
toString in class java.lang.Object
Returns:
string

execute

public abstract <R,D> R execute(IAttributeVisitor<R,D> visitor,
                                D param)
Execute a visitor on this attribute.

Parameters:
visitor - visitor
param - visitor-specific parameter
Returns:
visitor-specific return value

adjustPC

public abstract void adjustPC(short startPC,
                              short deltaPC)
Adjust program counter values contained in this attribute, starting at startPC, by adding deltaPC to them.

Parameters:
startPC - program counter to start at
deltaPC - change in program counter values

translatePC

public abstract void translatePC(short index,
                                 short deltaIndex,
                                 LineNumberTable oldLnt,
                                 LineNumberTable newLnt)
Translate the program counter values contained in this attribute from an old line number table to a new one.

Parameters:
index - critical point (insertion or deletion point)
deltaIndex - delta value to add to all old line numbers greater than the critical point
oldLnt - old line number table
newLnt - new line number table

lone

public java.lang.Object lone()
                      throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.

Returns:
a clone of this instance.
Throws:
java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface.