jtulach@258
|
1 |
/*
|
jtulach@258
|
2 |
* Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
|
jtulach@258
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
jtulach@258
|
4 |
*
|
jtulach@258
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
jtulach@258
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
jtulach@258
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
jtulach@258
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
jtulach@258
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
jtulach@258
|
10 |
*
|
jtulach@258
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
jtulach@258
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
jtulach@258
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
jtulach@258
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
jtulach@258
|
15 |
* accompanied this code).
|
jtulach@258
|
16 |
*
|
jtulach@258
|
17 |
* You should have received a copy of the GNU General Public License version
|
jtulach@258
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
jtulach@258
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
jtulach@258
|
20 |
*
|
jtulach@258
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
jtulach@258
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
jtulach@258
|
23 |
* questions.
|
jtulach@258
|
24 |
*/
|
jtulach@258
|
25 |
|
jtulach@258
|
26 |
package java.lang.reflect;
|
jtulach@258
|
27 |
|
jtulach@258
|
28 |
/**
|
jtulach@258
|
29 |
* The Modifier class provides {@code static} methods and
|
jtulach@258
|
30 |
* constants to decode class and member access modifiers. The sets of
|
jtulach@258
|
31 |
* modifiers are represented as integers with distinct bit positions
|
jtulach@258
|
32 |
* representing different modifiers. The values for the constants
|
jtulach@258
|
33 |
* representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of
|
jtulach@258
|
34 |
* <cite>The Java™ Virtual Machine Specification</cite>.
|
jtulach@258
|
35 |
*
|
jtulach@258
|
36 |
* @see Class#getModifiers()
|
jtulach@258
|
37 |
* @see Member#getModifiers()
|
jtulach@258
|
38 |
*
|
jtulach@258
|
39 |
* @author Nakul Saraiya
|
jtulach@258
|
40 |
* @author Kenneth Russell
|
jtulach@258
|
41 |
*/
|
jtulach@258
|
42 |
public
|
jtulach@258
|
43 |
class Modifier {
|
jtulach@258
|
44 |
|
jtulach@258
|
45 |
/**
|
jtulach@258
|
46 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
47 |
* {@code public} modifier, {@code false} otherwise.
|
jtulach@258
|
48 |
*
|
jtulach@258
|
49 |
* @param mod a set of modifiers
|
jtulach@258
|
50 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
51 |
* {@code public} modifier; {@code false} otherwise.
|
jtulach@258
|
52 |
*/
|
jtulach@258
|
53 |
public static boolean isPublic(int mod) {
|
jtulach@258
|
54 |
return (mod & PUBLIC) != 0;
|
jtulach@258
|
55 |
}
|
jtulach@258
|
56 |
|
jtulach@258
|
57 |
/**
|
jtulach@258
|
58 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
59 |
* {@code private} modifier, {@code false} otherwise.
|
jtulach@258
|
60 |
*
|
jtulach@258
|
61 |
* @param mod a set of modifiers
|
jtulach@258
|
62 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
63 |
* {@code private} modifier; {@code false} otherwise.
|
jtulach@258
|
64 |
*/
|
jtulach@258
|
65 |
public static boolean isPrivate(int mod) {
|
jtulach@258
|
66 |
return (mod & PRIVATE) != 0;
|
jtulach@258
|
67 |
}
|
jtulach@258
|
68 |
|
jtulach@258
|
69 |
/**
|
jtulach@258
|
70 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
71 |
* {@code protected} modifier, {@code false} otherwise.
|
jtulach@258
|
72 |
*
|
jtulach@258
|
73 |
* @param mod a set of modifiers
|
jtulach@258
|
74 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
75 |
* {@code protected} modifier; {@code false} otherwise.
|
jtulach@258
|
76 |
*/
|
jtulach@258
|
77 |
public static boolean isProtected(int mod) {
|
jtulach@258
|
78 |
return (mod & PROTECTED) != 0;
|
jtulach@258
|
79 |
}
|
jtulach@258
|
80 |
|
jtulach@258
|
81 |
/**
|
jtulach@258
|
82 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
83 |
* {@code static} modifier, {@code false} otherwise.
|
jtulach@258
|
84 |
*
|
jtulach@258
|
85 |
* @param mod a set of modifiers
|
jtulach@258
|
86 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
87 |
* {@code static} modifier; {@code false} otherwise.
|
jtulach@258
|
88 |
*/
|
jtulach@258
|
89 |
public static boolean isStatic(int mod) {
|
jtulach@258
|
90 |
return (mod & STATIC) != 0;
|
jtulach@258
|
91 |
}
|
jtulach@258
|
92 |
|
jtulach@258
|
93 |
/**
|
jtulach@258
|
94 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
95 |
* {@code final} modifier, {@code false} otherwise.
|
jtulach@258
|
96 |
*
|
jtulach@258
|
97 |
* @param mod a set of modifiers
|
jtulach@258
|
98 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
99 |
* {@code final} modifier; {@code false} otherwise.
|
jtulach@258
|
100 |
*/
|
jtulach@258
|
101 |
public static boolean isFinal(int mod) {
|
jtulach@258
|
102 |
return (mod & FINAL) != 0;
|
jtulach@258
|
103 |
}
|
jtulach@258
|
104 |
|
jtulach@258
|
105 |
/**
|
jtulach@258
|
106 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
107 |
* {@code synchronized} modifier, {@code false} otherwise.
|
jtulach@258
|
108 |
*
|
jtulach@258
|
109 |
* @param mod a set of modifiers
|
jtulach@258
|
110 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
111 |
* {@code synchronized} modifier; {@code false} otherwise.
|
jtulach@258
|
112 |
*/
|
jtulach@258
|
113 |
public static boolean isSynchronized(int mod) {
|
jtulach@258
|
114 |
return (mod & SYNCHRONIZED) != 0;
|
jtulach@258
|
115 |
}
|
jtulach@258
|
116 |
|
jtulach@258
|
117 |
/**
|
jtulach@258
|
118 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
119 |
* {@code volatile} modifier, {@code false} otherwise.
|
jtulach@258
|
120 |
*
|
jtulach@258
|
121 |
* @param mod a set of modifiers
|
jtulach@258
|
122 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
123 |
* {@code volatile} modifier; {@code false} otherwise.
|
jtulach@258
|
124 |
*/
|
jtulach@258
|
125 |
public static boolean isVolatile(int mod) {
|
jtulach@258
|
126 |
return (mod & VOLATILE) != 0;
|
jtulach@258
|
127 |
}
|
jtulach@258
|
128 |
|
jtulach@258
|
129 |
/**
|
jtulach@258
|
130 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
131 |
* {@code transient} modifier, {@code false} otherwise.
|
jtulach@258
|
132 |
*
|
jtulach@258
|
133 |
* @param mod a set of modifiers
|
jtulach@258
|
134 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
135 |
* {@code transient} modifier; {@code false} otherwise.
|
jtulach@258
|
136 |
*/
|
jtulach@258
|
137 |
public static boolean isTransient(int mod) {
|
jtulach@258
|
138 |
return (mod & TRANSIENT) != 0;
|
jtulach@258
|
139 |
}
|
jtulach@258
|
140 |
|
jtulach@258
|
141 |
/**
|
jtulach@258
|
142 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
143 |
* {@code native} modifier, {@code false} otherwise.
|
jtulach@258
|
144 |
*
|
jtulach@258
|
145 |
* @param mod a set of modifiers
|
jtulach@258
|
146 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
147 |
* {@code native} modifier; {@code false} otherwise.
|
jtulach@258
|
148 |
*/
|
jtulach@258
|
149 |
public static boolean isNative(int mod) {
|
jtulach@258
|
150 |
return (mod & NATIVE) != 0;
|
jtulach@258
|
151 |
}
|
jtulach@258
|
152 |
|
jtulach@258
|
153 |
/**
|
jtulach@258
|
154 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
155 |
* {@code interface} modifier, {@code false} otherwise.
|
jtulach@258
|
156 |
*
|
jtulach@258
|
157 |
* @param mod a set of modifiers
|
jtulach@258
|
158 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
159 |
* {@code interface} modifier; {@code false} otherwise.
|
jtulach@258
|
160 |
*/
|
jtulach@258
|
161 |
public static boolean isInterface(int mod) {
|
jtulach@258
|
162 |
return (mod & INTERFACE) != 0;
|
jtulach@258
|
163 |
}
|
jtulach@258
|
164 |
|
jtulach@258
|
165 |
/**
|
jtulach@258
|
166 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
167 |
* {@code abstract} modifier, {@code false} otherwise.
|
jtulach@258
|
168 |
*
|
jtulach@258
|
169 |
* @param mod a set of modifiers
|
jtulach@258
|
170 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
171 |
* {@code abstract} modifier; {@code false} otherwise.
|
jtulach@258
|
172 |
*/
|
jtulach@258
|
173 |
public static boolean isAbstract(int mod) {
|
jtulach@258
|
174 |
return (mod & ABSTRACT) != 0;
|
jtulach@258
|
175 |
}
|
jtulach@258
|
176 |
|
jtulach@258
|
177 |
/**
|
jtulach@258
|
178 |
* Return {@code true} if the integer argument includes the
|
jtulach@258
|
179 |
* {@code strictfp} modifier, {@code false} otherwise.
|
jtulach@258
|
180 |
*
|
jtulach@258
|
181 |
* @param mod a set of modifiers
|
jtulach@258
|
182 |
* @return {@code true} if {@code mod} includes the
|
jtulach@258
|
183 |
* {@code strictfp} modifier; {@code false} otherwise.
|
jtulach@258
|
184 |
*/
|
jtulach@258
|
185 |
public static boolean isStrict(int mod) {
|
jtulach@258
|
186 |
return (mod & STRICT) != 0;
|
jtulach@258
|
187 |
}
|
jtulach@258
|
188 |
|
jtulach@258
|
189 |
/**
|
jtulach@258
|
190 |
* Return a string describing the access modifier flags in
|
jtulach@258
|
191 |
* the specified modifier. For example:
|
jtulach@258
|
192 |
* <blockquote><pre>
|
jtulach@258
|
193 |
* public final synchronized strictfp
|
jtulach@258
|
194 |
* </pre></blockquote>
|
jtulach@258
|
195 |
* The modifier names are returned in an order consistent with the
|
jtulach@258
|
196 |
* suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of
|
jtulach@258
|
197 |
* <cite>The Java™ Language Specification</cite>.
|
jtulach@258
|
198 |
* The full modifier ordering used by this method is:
|
jtulach@258
|
199 |
* <blockquote> {@code
|
jtulach@258
|
200 |
* public protected private abstract static final transient
|
jtulach@258
|
201 |
* volatile synchronized native strictfp
|
jtulach@258
|
202 |
* interface } </blockquote>
|
jtulach@258
|
203 |
* The {@code interface} modifier discussed in this class is
|
jtulach@258
|
204 |
* not a true modifier in the Java language and it appears after
|
jtulach@258
|
205 |
* all other modifiers listed by this method. This method may
|
jtulach@258
|
206 |
* return a string of modifiers that are not valid modifiers of a
|
jtulach@258
|
207 |
* Java entity; in other words, no checking is done on the
|
jtulach@258
|
208 |
* possible validity of the combination of modifiers represented
|
jtulach@258
|
209 |
* by the input.
|
jtulach@258
|
210 |
*
|
jtulach@258
|
211 |
* Note that to perform such checking for a known kind of entity,
|
jtulach@258
|
212 |
* such as a constructor or method, first AND the argument of
|
jtulach@258
|
213 |
* {@code toString} with the appropriate mask from a method like
|
jtulach@258
|
214 |
* {@link #constructorModifiers} or {@link #methodModifiers}.
|
jtulach@258
|
215 |
*
|
jtulach@258
|
216 |
* @param mod a set of modifiers
|
jtulach@258
|
217 |
* @return a string representation of the set of modifiers
|
jtulach@258
|
218 |
* represented by {@code mod}
|
jtulach@258
|
219 |
*/
|
jtulach@258
|
220 |
public static String toString(int mod) {
|
jtulach@258
|
221 |
StringBuffer sb = new StringBuffer();
|
jtulach@258
|
222 |
int len;
|
jtulach@258
|
223 |
|
jtulach@258
|
224 |
if ((mod & PUBLIC) != 0) sb.append("public ");
|
jtulach@258
|
225 |
if ((mod & PROTECTED) != 0) sb.append("protected ");
|
jtulach@258
|
226 |
if ((mod & PRIVATE) != 0) sb.append("private ");
|
jtulach@258
|
227 |
|
jtulach@258
|
228 |
/* Canonical order */
|
jtulach@258
|
229 |
if ((mod & ABSTRACT) != 0) sb.append("abstract ");
|
jtulach@258
|
230 |
if ((mod & STATIC) != 0) sb.append("static ");
|
jtulach@258
|
231 |
if ((mod & FINAL) != 0) sb.append("final ");
|
jtulach@258
|
232 |
if ((mod & TRANSIENT) != 0) sb.append("transient ");
|
jtulach@258
|
233 |
if ((mod & VOLATILE) != 0) sb.append("volatile ");
|
jtulach@258
|
234 |
if ((mod & SYNCHRONIZED) != 0) sb.append("synchronized ");
|
jtulach@258
|
235 |
if ((mod & NATIVE) != 0) sb.append("native ");
|
jtulach@258
|
236 |
if ((mod & STRICT) != 0) sb.append("strictfp ");
|
jtulach@258
|
237 |
if ((mod & INTERFACE) != 0) sb.append("interface ");
|
jtulach@258
|
238 |
|
jtulach@258
|
239 |
if ((len = sb.length()) > 0) /* trim trailing space */
|
jtulach@258
|
240 |
return sb.toString().substring(0, len-1);
|
jtulach@258
|
241 |
return "";
|
jtulach@258
|
242 |
}
|
jtulach@258
|
243 |
|
jtulach@258
|
244 |
/*
|
jtulach@258
|
245 |
* Access modifier flag constants from tables 4.1, 4.4, 4.5, and 4.7 of
|
jtulach@258
|
246 |
* <cite>The Java™ Virtual Machine Specification</cite>
|
jtulach@258
|
247 |
*/
|
jtulach@258
|
248 |
|
jtulach@258
|
249 |
/**
|
jtulach@258
|
250 |
* The {@code int} value representing the {@code public}
|
jtulach@258
|
251 |
* modifier.
|
jtulach@258
|
252 |
*/
|
jtulach@258
|
253 |
public static final int PUBLIC = 0x00000001;
|
jtulach@258
|
254 |
|
jtulach@258
|
255 |
/**
|
jtulach@258
|
256 |
* The {@code int} value representing the {@code private}
|
jtulach@258
|
257 |
* modifier.
|
jtulach@258
|
258 |
*/
|
jtulach@258
|
259 |
public static final int PRIVATE = 0x00000002;
|
jtulach@258
|
260 |
|
jtulach@258
|
261 |
/**
|
jtulach@258
|
262 |
* The {@code int} value representing the {@code protected}
|
jtulach@258
|
263 |
* modifier.
|
jtulach@258
|
264 |
*/
|
jtulach@258
|
265 |
public static final int PROTECTED = 0x00000004;
|
jtulach@258
|
266 |
|
jtulach@258
|
267 |
/**
|
jtulach@258
|
268 |
* The {@code int} value representing the {@code static}
|
jtulach@258
|
269 |
* modifier.
|
jtulach@258
|
270 |
*/
|
jtulach@258
|
271 |
public static final int STATIC = 0x00000008;
|
jtulach@258
|
272 |
|
jtulach@258
|
273 |
/**
|
jtulach@258
|
274 |
* The {@code int} value representing the {@code final}
|
jtulach@258
|
275 |
* modifier.
|
jtulach@258
|
276 |
*/
|
jtulach@258
|
277 |
public static final int FINAL = 0x00000010;
|
jtulach@258
|
278 |
|
jtulach@258
|
279 |
/**
|
jtulach@258
|
280 |
* The {@code int} value representing the {@code synchronized}
|
jtulach@258
|
281 |
* modifier.
|
jtulach@258
|
282 |
*/
|
jtulach@258
|
283 |
public static final int SYNCHRONIZED = 0x00000020;
|
jtulach@258
|
284 |
|
jtulach@258
|
285 |
/**
|
jtulach@258
|
286 |
* The {@code int} value representing the {@code volatile}
|
jtulach@258
|
287 |
* modifier.
|
jtulach@258
|
288 |
*/
|
jtulach@258
|
289 |
public static final int VOLATILE = 0x00000040;
|
jtulach@258
|
290 |
|
jtulach@258
|
291 |
/**
|
jtulach@258
|
292 |
* The {@code int} value representing the {@code transient}
|
jtulach@258
|
293 |
* modifier.
|
jtulach@258
|
294 |
*/
|
jtulach@258
|
295 |
public static final int TRANSIENT = 0x00000080;
|
jtulach@258
|
296 |
|
jtulach@258
|
297 |
/**
|
jtulach@258
|
298 |
* The {@code int} value representing the {@code native}
|
jtulach@258
|
299 |
* modifier.
|
jtulach@258
|
300 |
*/
|
jtulach@258
|
301 |
public static final int NATIVE = 0x00000100;
|
jtulach@258
|
302 |
|
jtulach@258
|
303 |
/**
|
jtulach@258
|
304 |
* The {@code int} value representing the {@code interface}
|
jtulach@258
|
305 |
* modifier.
|
jtulach@258
|
306 |
*/
|
jtulach@258
|
307 |
public static final int INTERFACE = 0x00000200;
|
jtulach@258
|
308 |
|
jtulach@258
|
309 |
/**
|
jtulach@258
|
310 |
* The {@code int} value representing the {@code abstract}
|
jtulach@258
|
311 |
* modifier.
|
jtulach@258
|
312 |
*/
|
jtulach@258
|
313 |
public static final int ABSTRACT = 0x00000400;
|
jtulach@258
|
314 |
|
jtulach@258
|
315 |
/**
|
jtulach@258
|
316 |
* The {@code int} value representing the {@code strictfp}
|
jtulach@258
|
317 |
* modifier.
|
jtulach@258
|
318 |
*/
|
jtulach@258
|
319 |
public static final int STRICT = 0x00000800;
|
jtulach@258
|
320 |
|
jtulach@258
|
321 |
// Bits not (yet) exposed in the public API either because they
|
jtulach@258
|
322 |
// have different meanings for fields and methods and there is no
|
jtulach@258
|
323 |
// way to distinguish between the two in this class, or because
|
jtulach@258
|
324 |
// they are not Java programming language keywords
|
jtulach@258
|
325 |
static final int BRIDGE = 0x00000040;
|
jtulach@258
|
326 |
static final int VARARGS = 0x00000080;
|
jtulach@258
|
327 |
static final int SYNTHETIC = 0x00001000;
|
jtulach@258
|
328 |
static final int ANNOTATION= 0x00002000;
|
jtulach@258
|
329 |
static final int ENUM = 0x00004000;
|
jtulach@258
|
330 |
static boolean isSynthetic(int mod) {
|
jtulach@258
|
331 |
return (mod & SYNTHETIC) != 0;
|
jtulach@258
|
332 |
}
|
jtulach@258
|
333 |
|
jtulach@258
|
334 |
/**
|
jtulach@258
|
335 |
* See JLSv3 section 8.1.1.
|
jtulach@258
|
336 |
*/
|
jtulach@258
|
337 |
private static final int CLASS_MODIFIERS =
|
jtulach@258
|
338 |
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
|
jtulach@258
|
339 |
Modifier.ABSTRACT | Modifier.STATIC | Modifier.FINAL |
|
jtulach@258
|
340 |
Modifier.STRICT;
|
jtulach@258
|
341 |
|
jtulach@258
|
342 |
/**
|
jtulach@258
|
343 |
* See JLSv3 section 9.1.1.
|
jtulach@258
|
344 |
*/
|
jtulach@258
|
345 |
private static final int INTERFACE_MODIFIERS =
|
jtulach@258
|
346 |
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
|
jtulach@258
|
347 |
Modifier.ABSTRACT | Modifier.STATIC | Modifier.STRICT;
|
jtulach@258
|
348 |
|
jtulach@258
|
349 |
|
jtulach@258
|
350 |
/**
|
jtulach@258
|
351 |
* See JLSv3 section 8.8.3.
|
jtulach@258
|
352 |
*/
|
jtulach@258
|
353 |
private static final int CONSTRUCTOR_MODIFIERS =
|
jtulach@258
|
354 |
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE;
|
jtulach@258
|
355 |
|
jtulach@258
|
356 |
/**
|
jtulach@258
|
357 |
* See JLSv3 section 8.4.3.
|
jtulach@258
|
358 |
*/
|
jtulach@258
|
359 |
private static final int METHOD_MODIFIERS =
|
jtulach@258
|
360 |
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
|
jtulach@258
|
361 |
Modifier.ABSTRACT | Modifier.STATIC | Modifier.FINAL |
|
jtulach@258
|
362 |
Modifier.SYNCHRONIZED | Modifier.NATIVE | Modifier.STRICT;
|
jtulach@258
|
363 |
|
jtulach@258
|
364 |
/**
|
jtulach@258
|
365 |
* See JLSv3 section 8.3.1.
|
jtulach@258
|
366 |
*/
|
jtulach@258
|
367 |
private static final int FIELD_MODIFIERS =
|
jtulach@258
|
368 |
Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
|
jtulach@258
|
369 |
Modifier.STATIC | Modifier.FINAL | Modifier.TRANSIENT |
|
jtulach@258
|
370 |
Modifier.VOLATILE;
|
jtulach@258
|
371 |
|
jtulach@258
|
372 |
/**
|
jtulach@258
|
373 |
* Return an {@code int} value OR-ing together the source language
|
jtulach@258
|
374 |
* modifiers that can be applied to a class.
|
jtulach@258
|
375 |
* @return an {@code int} value OR-ing together the source language
|
jtulach@258
|
376 |
* modifiers that can be applied to a class.
|
jtulach@258
|
377 |
*
|
jtulach@258
|
378 |
* @jls 8.1.1 Class Modifiers
|
jtulach@258
|
379 |
* @since 1.7
|
jtulach@258
|
380 |
*/
|
jtulach@258
|
381 |
public static int classModifiers() {
|
jtulach@258
|
382 |
return CLASS_MODIFIERS;
|
jtulach@258
|
383 |
}
|
jtulach@258
|
384 |
|
jtulach@258
|
385 |
/**
|
jtulach@258
|
386 |
* Return an {@code int} value OR-ing together the source language
|
jtulach@258
|
387 |
* modifiers that can be applied to an interface.
|
jtulach@258
|
388 |
* @return an {@code int} value OR-ing together the source language
|
jtulach@258
|
389 |
* modifiers that can be applied to an inteface.
|
jtulach@258
|
390 |
*
|
jtulach@258
|
391 |
* @jls 9.1.1 Interface Modifiers
|
jtulach@258
|
392 |
* @since 1.7
|
jtulach@258
|
393 |
*/
|
jtulach@258
|
394 |
public static int interfaceModifiers() {
|
jtulach@258
|
395 |
return INTERFACE_MODIFIERS;
|
jtulach@258
|
396 |
}
|
jtulach@258
|
397 |
|
jtulach@258
|
398 |
/**
|
jtulach@258
|
399 |
* Return an {@code int} value OR-ing together the source language
|
jtulach@258
|
400 |
* modifiers that can be applied to a constructor.
|
jtulach@258
|
401 |
* @return an {@code int} value OR-ing together the source language
|
jtulach@258
|
402 |
* modifiers that can be applied to a constructor.
|
jtulach@258
|
403 |
*
|
jtulach@258
|
404 |
* @jls 8.8.3 Constructor Modifiers
|
jtulach@258
|
405 |
* @since 1.7
|
jtulach@258
|
406 |
*/
|
jtulach@258
|
407 |
public static int constructorModifiers() {
|
jtulach@258
|
408 |
return CONSTRUCTOR_MODIFIERS;
|
jtulach@258
|
409 |
}
|
jtulach@258
|
410 |
|
jtulach@258
|
411 |
/**
|
jtulach@258
|
412 |
* Return an {@code int} value OR-ing together the source language
|
jtulach@258
|
413 |
* modifiers that can be applied to a method.
|
jtulach@258
|
414 |
* @return an {@code int} value OR-ing together the source language
|
jtulach@258
|
415 |
* modifiers that can be applied to a method.
|
jtulach@258
|
416 |
*
|
jtulach@258
|
417 |
* @jls 8.4.3 Method Modifiers
|
jtulach@258
|
418 |
* @since 1.7
|
jtulach@258
|
419 |
*/
|
jtulach@258
|
420 |
public static int methodModifiers() {
|
jtulach@258
|
421 |
return METHOD_MODIFIERS;
|
jtulach@258
|
422 |
}
|
jtulach@258
|
423 |
|
jtulach@258
|
424 |
|
jtulach@258
|
425 |
/**
|
jtulach@258
|
426 |
* Return an {@code int} value OR-ing together the source language
|
jtulach@258
|
427 |
* modifiers that can be applied to a field.
|
jtulach@258
|
428 |
* @return an {@code int} value OR-ing together the source language
|
jtulach@258
|
429 |
* modifiers that can be applied to a field.
|
jtulach@258
|
430 |
*
|
jtulach@258
|
431 |
* @jls 8.3.1 Field Modifiers
|
jtulach@258
|
432 |
* @since 1.7
|
jtulach@258
|
433 |
*/
|
jtulach@258
|
434 |
public static int fieldModifiers() {
|
jtulach@258
|
435 |
return FIELD_MODIFIERS;
|
jtulach@258
|
436 |
}
|
jtulach@258
|
437 |
}
|