edu.rice.cs.cunit.classFile
Class MethodInfo

java.lang.Object
  extended by edu.rice.cs.cunit.classFile.MethodInfo

public final class MethodInfo
extends java.lang.Object

Represents a method in a class file.

Author:
Mathias Ricken

Field Summary
private  short _accessFlags
          Method access flags.
private  java.util.ArrayList<AAttributeInfo> _attributes
          Attributes.
private  AUTFPoolInfo _descriptor
          Type descriptor information.
private  AUTFPoolInfo _name
          Name information.
 
Constructor Summary
MethodInfo(java.io.DataInputStream di, ConstantPool pool)
          Constructor
MethodInfo(short accessFlags, AUTFPoolInfo name, AUTFPoolInfo signature, AAttributeInfo[] attributes)
          Constructor
 
Method Summary
 java.util.ArrayList<LineNumberTableAttributeInfo.LineNumberRecord> checkLineNumbers()
          Check the line number table for errors and return a list of erroneous LineNumberRecords.
 boolean equals(java.lang.Object o)
          Indicates whether some other object is "equal to" this one.
 short getAccessFlags()
          Accessor for access flags.
 AAttributeInfo getAttribute(java.lang.String name)
          Return the attribute with the specified name.
 java.util.ArrayList<AAttributeInfo> getAttributes()
          Accessor for attributes.
 CodeAttributeInfo getCodeAttributeInfo()
          Return this method's code attribute info.
 AUTFPoolInfo getDescriptor()
          Accessor for descriptor.
 AUTFPoolInfo getName()
          Accessor for field name.
 java.lang.String getSignature()
          Return the method's signature, i.e.
 int hashCode()
          Returns a hash code value for the object.
 void setAccessFlags(short accessFlags)
          Mutator for access flags.
 void setDescriptor(AUTFPoolInfo descriptor)
          Mutator for descriptor.
 void setName(AUTFPoolInfo name)
          Mutator for field name.
 java.lang.String toString()
          Return a human-readable version of this method.
 java.lang.String toString(ConstantPool pool)
          Return a human-readable version of this method.
 java.lang.String toString(ConstantPool pool, boolean lineNumbers, boolean PCs)
          Return a human-readable version of this method.
 void write(java.io.DataOutputStream dos, ConstantPool pool)
          Write this method into the stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_accessFlags

private short _accessFlags
Method access flags.


_name

private AUTFPoolInfo _name
Name information.


_descriptor

private AUTFPoolInfo _descriptor
Type descriptor information.


_attributes

private java.util.ArrayList<AAttributeInfo> _attributes
Attributes.

Constructor Detail

MethodInfo

public MethodInfo(short accessFlags,
                  AUTFPoolInfo name,
                  AUTFPoolInfo signature,
                  AAttributeInfo[] attributes)
Constructor

Parameters:
accessFlags - method access flags
name - method name
signature - method descriptor
attributes - array of attributes

MethodInfo

public MethodInfo(java.io.DataInputStream di,
                  ConstantPool pool)
           throws java.io.IOException,
                  java.lang.ClassFormatError
Constructor

Parameters:
di - input stream
pool - constant pool
Throws:
java.io.IOException
java.lang.ClassFormatError
Method Detail

write

public void write(java.io.DataOutputStream dos,
                  ConstantPool pool)
           throws java.io.IOException
Write this method into the stream.

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

toString

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

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

toString

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

Parameters:
pool - constant pool
Returns:
string

toString

public java.lang.String toString(ConstantPool pool,
                                 boolean lineNumbers,
                                 boolean PCs)
Return a human-readable version of this method.

Parameters:
pool - constant pool
lineNumbers - print line numbers
PCs - print PC values
Returns:
string

checkLineNumbers

public java.util.ArrayList<LineNumberTableAttributeInfo.LineNumberRecord> checkLineNumbers()
Check the line number table for errors and return a list of erroneous LineNumberRecords.

Returns:
list of errors; empty if none found

getAccessFlags

public short getAccessFlags()
Accessor for access flags.

Returns:
access flags

setAccessFlags

public void setAccessFlags(short accessFlags)
Mutator for access flags.

Parameters:
accessFlags - new access flags

getName

public AUTFPoolInfo getName()
Accessor for field name.

Returns:
field name

setName

public void setName(AUTFPoolInfo name)
Mutator for field name.

Parameters:
name - new field name

getDescriptor

public AUTFPoolInfo getDescriptor()
Accessor for descriptor.

Returns:
descriptor

setDescriptor

public void setDescriptor(AUTFPoolInfo descriptor)
Mutator for descriptor.

Parameters:
descriptor - new descriptor

getAttributes

public java.util.ArrayList<AAttributeInfo> getAttributes()
Accessor for attributes.

Returns:
attributes

getAttribute

public AAttributeInfo getAttribute(java.lang.String name)
Return the attribute with the specified name.

Parameters:
name - attribute name
Returns:
attribute or null if not found

getCodeAttributeInfo

public CodeAttributeInfo getCodeAttributeInfo()
Return this method's code attribute info.

Returns:
code attribute info

getSignature

public java.lang.String getSignature()
Return the method's signature, i.e. it's name with parameter types followed in parentheses: "foo(int,float,java.lang.String)".

Returns:
signature

equals

public boolean equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.