comparison graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ModifiersProvider.java @ 21556:48c1ebd24120

renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Wed, 27 May 2015 00:36:16 +0200
parents graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ModifiersProvider.java@5a21cac1968f
children
comparison
equal deleted inserted replaced
21555:d12eaef9af72 21556:48c1ebd24120
1 /*
2 * Copyright (c) 2014, 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.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package com.oracle.jvmci.meta;
24
25 import static java.lang.reflect.Modifier.*;
26
27 import java.lang.reflect.*;
28
29 /**
30 * A Java element (i.e., a class, interface, field or method) that is described by a set of Java
31 * language {@linkplain #getModifiers() modifiers}.
32 */
33 public interface ModifiersProvider {
34
35 /**
36 * Returns the Java language modifiers for this element.
37 */
38 int getModifiers();
39
40 /**
41 * @see Modifier#isInterface(int)
42 */
43 default boolean isInterface() {
44 return Modifier.isInterface(getModifiers());
45 }
46
47 /**
48 * @see Modifier#isSynchronized(int)
49 */
50 default boolean isSynchronized() {
51 return Modifier.isSynchronized(getModifiers());
52 }
53
54 /**
55 * @see Modifier#isStatic(int)
56 */
57 default boolean isStatic() {
58 return Modifier.isStatic(getModifiers());
59 }
60
61 /**
62 * @see Modifier#isFinal(int)
63 */
64 default boolean isFinal() {
65 return Modifier.isFinal(getModifiers());
66 }
67
68 /**
69 * @see Modifier#isPublic(int)
70 */
71 default boolean isPublic() {
72 return Modifier.isPublic(getModifiers());
73 }
74
75 /**
76 * Determines if this element is neither {@linkplain #isPublic() public},
77 * {@linkplain #isProtected() protected} nor {@linkplain #isPrivate() private}.
78 */
79 default boolean isPackagePrivate() {
80 return ((PUBLIC | PROTECTED | PRIVATE) & getModifiers()) == 0;
81 }
82
83 /**
84 * @see Modifier#isPrivate(int)
85 */
86 default boolean isPrivate() {
87 return Modifier.isPrivate(getModifiers());
88 }
89
90 /**
91 * @see Modifier#isProtected(int)
92 */
93 default boolean isProtected() {
94 return Modifier.isProtected(getModifiers());
95 }
96
97 /**
98 * @see Modifier#isTransient(int)
99 */
100 default boolean isTransient() {
101 return Modifier.isTransient(getModifiers());
102 }
103
104 /**
105 * @see Modifier#isStrict(int)
106 */
107 default boolean isStrict() {
108 return Modifier.isStrict(getModifiers());
109 }
110
111 /**
112 * @see Modifier#isVolatile(int)
113 */
114 default boolean isVolatile() {
115 return Modifier.isVolatile(getModifiers());
116 }
117
118 /**
119 * @see Modifier#isNative(int)
120 */
121 default boolean isNative() {
122 return Modifier.isNative(getModifiers());
123 }
124
125 /**
126 * @see Modifier#isAbstract(int)
127 */
128 default boolean isAbstract() {
129 return Modifier.isAbstract(getModifiers());
130 }
131
132 /**
133 * Checks that the method is concrete and not abstract.
134 *
135 * @return whether the method is a concrete method
136 */
137 default boolean isConcrete() {
138 return !isAbstract();
139 }
140 }