blob: b6eeafe761e515001def8f83dedfd3691d3285e6 [file] [log] [blame]
package org.eclipse.jdt.internal.core.builder;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import org.eclipse.jdt.core.*;
/**
* A Method provides information about a single method
* on a class or interface. The method may be a class method
* or an instance method (including an abstract method).
*
* Changes from java.lang and java.lang.reflect:
* <ul>
* <li>toString() changed to be a handle-only method;
* it ignores the modifiers, return type, and exceptions.</li>
* </ul>
*
* @see IMember
* @see IType
* @see IType#getMethodHandle
* @see IType#getDeclaredMethods()
*/
public interface IMethod extends IMember {
/**
* Compares this Method handle against the specified object. Returns
* true if the objects are the same. Two Method handles are the same if
* they have the same declaring class and have the same method name
* and formal parameter types.
* See Handle.equals() for more details.
*
* @see IHandle#equals
* @see IHandle#hashCode
*/
boolean equals(Object obj);
/**
* Returns an array of Type objects that represent the types of
* the checked exceptions thrown by the method
* represented by this Method object.
* Unchecked exceptions are not included in the result, even if
* they are declared in the source.
* Returns an array of length 0 if the method throws no checked
* exceptions.
* The resulting Types are in no particular order.
*
* @exception NotPresentException if the method is not present.
*/
IType[] getExceptionTypes() throws NotPresentException;
/**
* Returns an array of Type objects that represent the formal
* parameter types, in declaration order, of the method
* represented by this Method object.
* Returns an array of length 0 if the underlying method takes
* no parameters.
* This is a handle-only method.
*/
IType[] getParameterTypes();
/**
* Returns a Type object that represents the formal return type
* of the method represented by this Method object.
*
* @exception NotPresentException if the method is not present.
*/
IType getReturnType() throws NotPresentException;
/**
* A method is present if:
* <ul>
* <li>its declaring class is present, and
* <li>the class declares a method of the same name and parameter types
* </ul>
* It is not necessary that the parameter types be present.
* See Handle.isPresent() for more details.
*
* @see #getParameterTypes
* @see IHandle#isPresent
* @see IMember#getDeclaringClass
*/
boolean isPresent();
/**
* Returns a string describing this Method handle. The string is
* formatted as the fully qualified name of the declaring class,
* followed by a period, followed by the method name,
* followed by a parenthesized, comma-separated list of the method's
* formal parameter types.
* For example:
* <pre>
* java.lang.Object.equals(java.lang.Object)
* java.lang.Object.wait(long,int)
* </pre>
*
* @see IHandle#toString
*/
String toString();
}