10
|
1 |
/*
|
25287
|
2 |
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
10
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5520
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
10
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5520
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
10
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5520
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
10
|
24 |
*/
|
|
25 |
|
|
26 |
package com.sun.source.tree;
|
|
27 |
|
|
28 |
import java.util.List;
|
|
29 |
import javax.lang.model.element.Name;
|
|
30 |
|
|
31 |
/**
|
|
32 |
* A tree node for a method or annotation type element declaration.
|
|
33 |
*
|
|
34 |
* For example:
|
|
35 |
* <pre>
|
|
36 |
* <em>modifiers</em> <em>typeParameters</em> <em>type</em> <em>name</em>
|
|
37 |
* ( <em>parameters</em> )
|
|
38 |
* <em>body</em>
|
|
39 |
*
|
|
40 |
* <em>modifiers</em> <em>type</em> <em>name</em> () default <em>defaultValue</em>
|
|
41 |
* </pre>
|
|
42 |
*
|
54817
|
43 |
* @jls 8.4 Method Declarations
|
|
44 |
* @jls 8.6 Instance Initializers
|
|
45 |
* @jls 8.7 Static Initializers
|
|
46 |
* @jls 9.4 Method Declarations
|
|
47 |
* @jls 9.6.1 Annotation Type Elements
|
10
|
48 |
*
|
|
49 |
* @author Peter von der Ahé
|
|
50 |
* @author Jonathan Gibbons
|
|
51 |
* @since 1.6
|
|
52 |
*/
|
|
53 |
public interface MethodTree extends Tree {
|
25287
|
54 |
/**
|
|
55 |
* Returns the modifiers, including any annotations for the method being declared.
|
|
56 |
* @return the modifiers
|
|
57 |
*/
|
10
|
58 |
ModifiersTree getModifiers();
|
25287
|
59 |
|
|
60 |
/**
|
|
61 |
* Returns the name of the method being declared.
|
|
62 |
* @return the name
|
|
63 |
*/
|
10
|
64 |
Name getName();
|
25287
|
65 |
|
|
66 |
/**
|
|
67 |
* Returns the return type of the method being declared.
|
|
68 |
* Returns {@code null} for a constructor.
|
|
69 |
* @return the return type
|
|
70 |
*/
|
10
|
71 |
Tree getReturnType();
|
25287
|
72 |
|
|
73 |
/**
|
|
74 |
* Returns the type parameters of the method being declared.
|
|
75 |
* @return the type parameters
|
|
76 |
*/
|
10
|
77 |
List<? extends TypeParameterTree> getTypeParameters();
|
25287
|
78 |
|
|
79 |
/**
|
|
80 |
* Returns the parameters of the method being declared.
|
|
81 |
* @return the parameters
|
|
82 |
*/
|
10
|
83 |
List<? extends VariableTree> getParameters();
|
19651
|
84 |
|
|
85 |
/**
|
25287
|
86 |
* Return an explicit receiver parameter ("this" parameter),
|
|
87 |
* or {@code null} if none.
|
19651
|
88 |
*
|
|
89 |
* @return an explicit receiver parameter ("this" parameter)
|
|
90 |
* @since 1.8
|
|
91 |
*/
|
15385
|
92 |
VariableTree getReceiverParameter();
|
19651
|
93 |
|
25287
|
94 |
/**
|
|
95 |
* Returns the exceptions listed as being thrown by this method.
|
|
96 |
* @return the exceptions
|
|
97 |
*/
|
10
|
98 |
List<? extends ExpressionTree> getThrows();
|
25287
|
99 |
|
|
100 |
/**
|
|
101 |
* Returns the method body, or {@code null} if this is an abstract or native method.
|
|
102 |
* @return the method body
|
|
103 |
*/
|
10
|
104 |
BlockTree getBody();
|
25287
|
105 |
|
|
106 |
/**
|
|
107 |
* Returns the default value, if this is an element within
|
|
108 |
* an annotation type declaration.
|
|
109 |
* Returns {@code null} otherwise.
|
|
110 |
* @return the default value
|
|
111 |
*/
|
10
|
112 |
Tree getDefaultValue(); // for annotation types
|
|
113 |
}
|