Source code: javax/ide/model/java/source/tree/MethodT.java
1 /*
2 * @(#)MethodT.java
3 */
4
5 package javax.ide.model.java.source.tree;
6
7 import java.util.List;
8
9 /**
10 * A method or constructor declaration. <p/>
11 *
12 * @author Andy Yu
13 * */
14 public interface MethodT
15 extends MemberT, HasNameT
16 {
17 // ----------------------------------------------------------------------
18
19 static final MethodT[] EMPTY_ARRAY = new MethodT[ 0 ];
20
21
22 // ----------------------------------------------------------------------
23
24 /**
25 * True if this is a constructor. Equivalent to asking
26 * getTreeKind() == TREE_CONSTRUCTOR_D.
27 *
28 * @return True if this is a constructor. False otherwise.
29 */
30 public boolean isConstructor();
31
32 /**
33 * Tests if this method is modified by ACC_VARARGS.
34 *
35 * @return True if this is a variable arguments method. False otherwise.
36 */
37 public boolean isVarargs();
38
39 /**
40 * Gets the ordered list of type parameters declared on this class.
41 * Remember, type parameters are not inherited by subclasses (and
42 * subinterfaces). <p/>
43 *
44 * For classes, syntax is "javadoc mods class name <ty_params> {}".
45 *
46 * @return The list of type parameters. <p/>
47 *
48 * List of TypeParameterTs.
49 */
50 public List getTypeParameters();
51
52 /**
53 * Gets the source return type.
54 *
55 * @return The TypeReferenceT for the return type of this method. Null if
56 * this is a constructor.
57 */
58 public TypeReferenceT getReturnType();
59
60 /**
61 * Attempts to set the return type of this method.
62 *
63 * @throws UnsupportedOperationException if this is a constructor.
64 */
65 public void setReturnType( TypeReferenceT type );
66
67 /**
68 * Gets the ordered list of parameters.
69 *
70 * @return The list of formal parameters. Does not include the synthetic
71 * "this$0" parameter where applicable. <p/>
72 *
73 * List of FormalParameterTs.
74 */
75 public List getParameters();
76
77 /**
78 * Gets the ordered list of exception types.
79 *
80 * @return The list of declared thrown exception types. Always non-null.
81 * Will have an element for each exception type that is declared, even
82 * if it is a RuntimeException subclass or if it cannot be legally
83 * resolved. <p/>
84 *
85 * List of TypeReferenceTs.
86 */
87 public List getExceptions();
88
89
90 // ----------------------------------------------------------------------
91
92 /**
93 * Gets the formal parameter list object.
94 *
95 * @return The formal parameter list belonging not this method (or
96 * constructor) declaration. Always non-null. If there is no formal
97 * parameter list, then a synthetic one is returned. Note: It is a compile
98 * error if there is no formal parameter list.
99 */
100 public FormalParameterListT getFormalParameterList();
101
102 /**
103 * Gets the throws clause object.
104 *
105 * @return The throws clause belonging to this method (or constructor)
106 * declaration. Always non-null. If there is no throws clause, then a
107 * synthetic one is returned.
108 */
109 public ThrowsT getThrowsClause();
110
111
112 // ----------------------------------------------------------------------
113 }