JML

org.multijava.util.classfile
Class UniverseMethodAttribute

java.lang.Object
  extended byorg.multijava.util.classfile.Attribute
      extended byorg.multijava.util.classfile.UniverseMethodAttribute

public class UniverseMethodAttribute
extends Attribute

This class implements a JUTS method attribute. The attribute contains information about the method's purity and the universe annotations of its parameters and return type. The format of the attribute (not including the standard initial six bytes): - the first byte is either 0 or 1, and represents the method's purity - the second byte is the return type's annotation. This is zero if the method has no return type - the following bytes are the parameter's annotations This attribute is recognized by UniverseAttributeParser. VMS 4.7.1: The attribute's name is org.multijava.universe_method

Author:
AHS
See Also:
UniverseAttributeParser

Field Summary
private static AsciiConstant attr
           
private  boolean isPure
          the method's purity
private  byte[] paramConstants
          the encoded universe type modifiers for the parameter types
private  byte retConstant
          the encoded universe type modifier for the return type
(package private) static String tagString
          the attribute's name
 
Constructor Summary
UniverseMethodAttribute(boolean isPure, byte retTypeByteConstant, byte[] paramConstants)
          Construct a method attribute for a method with non-void return type.
UniverseMethodAttribute(boolean isPure, byte[] paramConstants)
          Construct a method attribute for a method with void return type.
UniverseMethodAttribute(DataInput in, ConstantPool cp)
          Constructs a Universe Method Attribute from a class file stream.
 
Method Summary
 byte[] getParamConstants()
          Return the byte constants representing the parameter annotations.
 boolean getPurity()
          Return the method's purity.
 byte getRetTypeConstant()
          Return the byte constant representing the return type's annotation.
protected  int getSize()
          Return the attribute's size, this attribute has variable size dependent on the number of parameters.
protected  int getTag()
          Return this attribute's tag.
protected  void resolveConstants(ConstantPool cp)
          Insert or check location of constant value on constant pool.
protected  void write(ConstantPool cp, DataOutput out)
          Write this class into the the file (out) getting data position from the constant pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tagString

static final String tagString
the attribute's name


attr

private static AsciiConstant attr

isPure

private boolean isPure
the method's purity


retConstant

private byte retConstant
the encoded universe type modifier for the return type


paramConstants

private byte[] paramConstants
the encoded universe type modifiers for the parameter types

Constructor Detail

UniverseMethodAttribute

public UniverseMethodAttribute(boolean isPure,
                               byte[] paramConstants)
Construct a method attribute for a method with void return type.

Parameters:
isPure - the purity of the method
paramConstants - the byte constants for the parameters

UniverseMethodAttribute

public UniverseMethodAttribute(boolean isPure,
                               byte retTypeByteConstant,
                               byte[] paramConstants)
Construct a method attribute for a method with non-void return type.

Parameters:
isPure - the purity of the method
retTypeByteConstant - the byte constant for the return type
paramConstants - the byte constants for the parameters

UniverseMethodAttribute

public UniverseMethodAttribute(DataInput in,
                               ConstantPool cp)
                        throws IOException,
                               ClassFileFormatException
Constructs a Universe Method Attribute from a class file stream.

Parameters:
in - the stream to read from
cp - the constant pool
Throws:
IOException - an io problem has occured
ClassFileFormatException - attempt to write a bad classfile info
Method Detail

getPurity

public boolean getPurity()
Return the method's purity.


getRetTypeConstant

public byte getRetTypeConstant()
Return the byte constant representing the return type's annotation.


getParamConstants

public byte[] getParamConstants()
Return the byte constants representing the parameter annotations.


getTag

protected int getTag()
Return this attribute's tag.


getSize

protected int getSize()
Return the attribute's size, this attribute has variable size dependent on the number of parameters.


resolveConstants

protected void resolveConstants(ConstantPool cp)
                         throws ClassFileFormatException
Insert or check location of constant value on constant pool.

Parameters:
cp - the constant pool for this class
Throws:
ClassFileFormatException

write

protected void write(ConstantPool cp,
                     DataOutput out)
              throws IOException,
                     ClassFileFormatException
Write this class into the the file (out) getting data position from the constant pool.

Parameters:
cp - the constant pool that contain all data
out - the file where to write this object info
Throws:
IOException - an io problem has occured
ClassFileFormatException

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.