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
97
98
99
100
101
|
package org.eclipse.jdt.core;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import org.eclipse.jdt.internal.core.*;
/**
* Represents a method (or constructor) declared in a type.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*/
public interface IMethod extends IMember {
/**
* Returns the simple name of this method.
* For a constructor, this returns the simple name of the declaring type.
* Note: This holds whether the constructor appears in a source or binary type
* (even though class files internally define constructor names to be <code>"<init>"</code>).
* For the class initialization methods in binary types, this returns
* the special name <code>"<clinit>"</code>.
* This is a handle-only method.
*/
String getElementName();
/**
* Returns the type signatures of the exceptions this method throws,
* in the order declared in the source. Returns an empty array
* if this method throws no exceptions.
*
* <p>For example, a source method declaring <code>"throws IOException"</code>,
* would return the array <code>{"QIOException;"}</code>.
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*
* @see Signature
*/
String[] getExceptionTypes() throws JavaModelException;
/**
* Returns the number of parameters of this method.
* This is a handle-only method.
*/
int getNumberOfParameters();
/**
* Returns the names of parameters in this method.
* For binary types, these names are invented as "arg"+i, where i starts at 1
* (even if source is associated with the binary).
* Returns an empty array if this method has no parameters.
*
* <p>For example, a method declared as <code>public void foo(String text, int length)</code>
* would return the array <code>{"text","length"}</code>.
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*/
String[] getParameterNames() throws JavaModelException;
/**
* Returns the type signatures for the parameters of this method.
* Returns an empty array if this method has no parameters.
* This is a handle-only method.
*
* <p>For example, a source method declared as <code>public void foo(String text, int length)</code>
* would return the array <code>{"QString;","I"}</code>.
*
* @see Signature
*/
String[] getParameterTypes();
/**
* Returns the type signature of the return value of this method.
* For constructors, this returns the signature for void.
*
* <p>For example, a source method declared as <code>public String getName()</code>
* would return <code>"QString;"</code>.
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*
* @see Signature
*/
String getReturnType() throws JavaModelException;
/**
* Returns the signature of the method. This includes the signatures for the parameter
* types and return type, but does not include the method name or exception types.
*
* <p>For example, a source method declared as <code>public void foo(String text, int length)</code>
* would return <code>"(QString;I)V"</code>.
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*
* @see Signature
*/
String getSignature() throws JavaModelException;
/**
* Returns whether this method is a constructor.
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*/
boolean isConstructor() throws JavaModelException;
}
|