edu.rit.classfile
Class SubroutineReference

java.lang.Object
  extended by edu.rit.classfile.SubroutineReference
Direct Known Subclasses:
ClassInitializerReference, ConstructorReference, MethodReference, SubroutineDescription

public abstract class SubroutineReference
extends Object

Class SubroutineReference encapsulates the information needed to refer to a subroutine (method, constructor, or class initializer). This includes the subroutine's class, name, return type, and argument types. In the documentation below, the term "referenced subroutine" means "the subroutine referred to by this subroutine reference object."


Method Summary
 boolean equals(Object obj)
          Determine if this subroutine reference is equal to the given object.
 List getArgumentTypes()
          Returns a list of the referenced subroutine's argument types.
 int getArgumentWordCount()
          Returns the number of virtual machine words occupied on the operand stack by the referenced subroutine's arguments when the referenced subroutine is invoked.
 ClassReference getClassReference()
          Returns the class which contains the referenced subroutine.
 String getMethodDescriptor()
          Returns the referenced subroutine's method descriptor.
 String getMethodName()
          Returns the referenced subroutine's method name.
 TypeReference getReturnType()
          Returns the referenced subroutine's return type.
 int hashCode()
          Returns a hash code for this subroutine reference.
 String toString()
          Returns a string version of this subroutine reference.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getClassReference

public ClassReference getClassReference()
Returns the class which contains the referenced subroutine.


getMethodName

public String getMethodName()
Returns the referenced subroutine's method name.


getMethodDescriptor

public String getMethodDescriptor()
Returns the referenced subroutine's method descriptor.


getReturnType

public TypeReference getReturnType()
Returns the referenced subroutine's return type.

Returns:
Type reference for the return type, or null if the referenced subroutine doesn't return anything.

getArgumentTypes

public List getArgumentTypes()
Returns a list of the referenced subroutine's argument types. The returned list is unmodifiable. Each item in the list is an instance of class TypeReference. The arguments appear in the list in the order they were declared. If there are no arguments, the returned list's size is zero.


getArgumentWordCount

public int getArgumentWordCount()
Returns the number of virtual machine words occupied on the operand stack by the referenced subroutine's arguments when the referenced subroutine is invoked. This does not include the word occupied by the implicit this reference in the case of a non-static method or a constructor.


equals

public boolean equals(Object obj)
Determine if this subroutine reference is equal to the given object. To be equal, the given object must be a non-null instance of class SubroutineReference, with the same class reference, method name, and method descriptor as this subroutine reference.

Overrides:
equals in class Object
Parameters:
obj - Object to test.
Returns:
True if this subroutine reference is equal to the given object, false otherwise.

hashCode

public int hashCode()
Returns a hash code for this subroutine reference.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a string version of this subroutine reference. This is the return type (or void), followed by the fully qualified name of the subroutine, followed by the types of the arguments enclosed in parentheses.

Overrides:
toString in class Object


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.