author | alanb |
Thu, 01 Dec 2016 09:02:42 +0000 | |
changeset 42407 | f3702cff2933 |
parent 36526 | 3b41f1c69604 |
child 43376 | f165c71d9e03 |
permissions | -rw-r--r-- |
36526 | 1 |
/* |
2 |
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. |
|
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 |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
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 |
* |
|
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. |
|
24 |
*/ |
|
25 |
||
26 |
package javax.lang.model.element; |
|
27 |
||
28 |
import java.util.List; |
|
29 |
||
30 |
/** |
|
31 |
* Represents a module program element. Provides access to information |
|
32 |
* about the module and its members. |
|
33 |
* |
|
34 |
* @see javax.lang.model.util.Elements#getModuleOf |
|
35 |
* @since 9 |
|
36 |
*/ // TODO: add @jls to module section |
|
37 |
public interface ModuleElement extends Element, QualifiedNameable { |
|
38 |
||
39 |
/** |
|
40 |
* Returns the fully qualified name of this module. |
|
41 |
* |
|
42 |
* @return the qualified name of this module, or an |
|
43 |
* empty name if this is an unnamed module |
|
44 |
*/ |
|
45 |
@Override |
|
46 |
Name getQualifiedName(); |
|
47 |
||
48 |
/** |
|
49 |
* Returns the simple name of this module. For an unnamed |
|
50 |
* module, an empty name is returned. |
|
51 |
* |
|
52 |
* @return the simple name of this module or an empty name if |
|
53 |
* this is an unnamed module |
|
54 |
*/ |
|
55 |
@Override |
|
56 |
Name getSimpleName(); |
|
57 |
||
58 |
/** |
|
59 |
* Returns the packages within this module. |
|
60 |
* @return the packages within this module |
|
61 |
*/ |
|
62 |
@Override |
|
63 |
List<? extends Element> getEnclosedElements(); |
|
64 |
||
65 |
/** |
|
66 |
* Returns {@code true} if this is an unnamed module and {@code |
|
67 |
* false} otherwise. |
|
68 |
* |
|
69 |
* @return {@code true} if this is an unnamed module and {@code |
|
70 |
* false} otherwise |
|
71 |
*/ // TODO: add @jls to unnamed module section |
|
72 |
boolean isUnnamed(); |
|
73 |
||
74 |
/** |
|
75 |
* Returns {@code null} since a module is not enclosed by another |
|
76 |
* element. |
|
77 |
* |
|
78 |
* @return {@code null} |
|
79 |
*/ |
|
80 |
@Override |
|
81 |
Element getEnclosingElement(); |
|
82 |
||
83 |
/** |
|
84 |
* Returns the directives contained in the declaration of this module. |
|
85 |
* @return the directives in the declaration of this module |
|
86 |
*/ |
|
87 |
List<? extends Directive> getDirectives(); |
|
88 |
||
89 |
/** |
|
90 |
* The {@code kind} of a directive. |
|
91 |
* |
|
92 |
* <p>Note that it is possible additional directive kinds will be added |
|
93 |
* to accommodate new, currently unknown, language structures added to |
|
94 |
* future versions of the Java™ programming language. |
|
95 |
* |
|
96 |
* @since 9 |
|
97 |
*/ |
|
98 |
enum DirectiveKind { |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
99 |
/** A "requires (static|transitive)* module-name" directive. */ |
36526 | 100 |
REQUIRES, |
101 |
/** An "exports package-name [to module-name-list]" directive. */ |
|
102 |
EXPORTS, |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
103 |
/** An "opens package-name [to module-name-list]" directive. */ |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
104 |
OPENS, |
36526 | 105 |
/** A "uses service-name" directive. */ |
106 |
USES, |
|
107 |
/** A "provides service-name with implementation-name" directive. */ |
|
108 |
PROVIDES |
|
109 |
}; |
|
110 |
||
111 |
/** |
|
112 |
* Represents a "module statement" within the declaration of this module. |
|
113 |
* |
|
114 |
* @since 9 |
|
115 |
* |
|
116 |
*/ // TODO: add jls to Module Statement |
|
117 |
interface Directive { |
|
118 |
/** |
|
119 |
* Returns the {@code kind} of this directive. |
|
120 |
* |
|
121 |
* @return the kind of this directive |
|
122 |
*/ |
|
123 |
DirectiveKind getKind(); |
|
124 |
} |
|
125 |
||
126 |
/** |
|
127 |
* A dependency of a module. |
|
128 |
* @since 9 |
|
129 |
*/ |
|
130 |
interface RequiresDirective extends Directive { |
|
131 |
/** |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
132 |
* Returns whether or not this is a static dependency. |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
133 |
* @return whether or not this is a static dependency |
36526 | 134 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
135 |
boolean isStatic(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
136 |
|
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
137 |
/** |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
138 |
* Returns whether or not this is a transitive dependency. |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
139 |
* @return whether or not this is a transitive dependency |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
140 |
*/ |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
141 |
boolean isTransitive(); |
36526 | 142 |
|
143 |
/** |
|
144 |
* Returns the module that is required |
|
145 |
* @return the module that is required |
|
146 |
*/ |
|
147 |
ModuleElement getDependency(); |
|
148 |
} |
|
149 |
||
150 |
/** |
|
151 |
* An exported package of a module. |
|
152 |
* @since 9 |
|
153 |
*/ |
|
154 |
interface ExportsDirective extends Directive { |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
155 |
|
36526 | 156 |
/** |
157 |
* Returns the package being exported. |
|
158 |
* @return the package being exported |
|
159 |
*/ |
|
160 |
PackageElement getPackage(); |
|
161 |
||
162 |
/** |
|
163 |
* Returns the specific modules to which the package is being exported, |
|
164 |
* or null, if the package is exported to all modules which |
|
165 |
* have readability to this module. |
|
166 |
* @return the specific modules to which the package is being exported |
|
167 |
*/ |
|
168 |
List<? extends ModuleElement> getTargetModules(); |
|
169 |
} |
|
170 |
||
171 |
/** |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
172 |
* An opened package of a module. |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
173 |
* @since 9 |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
174 |
*/ |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
175 |
interface OpensDirective extends Directive { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
176 |
|
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
177 |
/** |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
178 |
* Returns the package being opened. |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
179 |
* @return the package being opened |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
180 |
*/ |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
181 |
PackageElement getPackage(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
182 |
|
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
183 |
/** |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
184 |
* Returns the specific modules to which the package is being open |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
185 |
* or null, if the package is open all modules which |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
186 |
* have readability to this module. |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
187 |
* @return the specific modules to which the package is being opened |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
188 |
*/ |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
189 |
List<? extends ModuleElement> getTargetModules(); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
190 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
191 |
|
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
192 |
/** |
36526 | 193 |
* An implementation of a service provided by a module. |
194 |
* @since 9 |
|
195 |
*/ |
|
196 |
interface ProvidesDirective extends Directive { |
|
197 |
/** |
|
198 |
* Returns the service being provided. |
|
199 |
* @return the service being provided |
|
200 |
*/ |
|
201 |
TypeElement getService(); |
|
202 |
||
203 |
/** |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
204 |
* Returns the implementations of the service being provided. |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
205 |
* @return the implementations of the service being provided |
36526 | 206 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
207 |
List<? extends TypeElement> getImplementations(); |
36526 | 208 |
} |
209 |
||
210 |
/** |
|
211 |
* A reference to a service used by a module. |
|
212 |
* @since 9 |
|
213 |
*/ |
|
214 |
interface UsesDirective extends Directive { |
|
215 |
/** |
|
216 |
* Returns the service that is used. |
|
217 |
* @return the service that is used |
|
218 |
*/ |
|
219 |
TypeElement getService(); |
|
220 |
} |
|
221 |
} |