Skip to main content
summaryrefslogtreecommitdiffstats
blob: b6eeafe761e515001def8f83dedfd3691d3285e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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();
}

Back to the top