author | darcy |
Wed, 06 Apr 2011 19:30:57 -0700 | |
changeset 9300 | c2de4dd9853b |
parent 8235 | 0f7e1f7a6a4b |
child 14725 | 65836e833f59 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
8235
0f7e1f7a6a4b
6961571: Update visitors to support ARM's ElementKind.RESOURCE_VARIABLE
darcy
parents:
5520
diff
changeset
|
2 |
* Copyright (c) 2005, 2011, 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 javax.lang.model.type; |
|
27 |
||
28 |
||
29 |
/** |
|
30 |
* The kind of a type mirror. |
|
31 |
* |
|
32 |
* <p>Note that it is possible additional type kinds will be added to |
|
33 |
* accommodate new, currently unknown, language structures added to |
|
34 |
* future versions of the Java™ programming language. |
|
35 |
* |
|
36 |
* @author Joseph D. Darcy |
|
37 |
* @author Scott Seligman |
|
38 |
* @author Peter von der Ahé |
|
39 |
* @see TypeMirror |
|
40 |
* @since 1.6 |
|
41 |
*/ |
|
42 |
public enum TypeKind { |
|
43 |
/** |
|
44 |
* The primitive type {@code boolean}. |
|
45 |
*/ |
|
46 |
BOOLEAN, |
|
47 |
||
48 |
/** |
|
49 |
* The primitive type {@code byte}. |
|
50 |
*/ |
|
51 |
BYTE, |
|
52 |
||
53 |
/** |
|
54 |
* The primitive type {@code short}. |
|
55 |
*/ |
|
56 |
SHORT, |
|
57 |
||
58 |
/** |
|
59 |
* The primitive type {@code int}. |
|
60 |
*/ |
|
61 |
INT, |
|
62 |
||
63 |
/** |
|
64 |
* The primitive type {@code long}. |
|
65 |
*/ |
|
66 |
LONG, |
|
67 |
||
68 |
/** |
|
69 |
* The primitive type {@code char}. |
|
70 |
*/ |
|
71 |
CHAR, |
|
72 |
||
73 |
/** |
|
74 |
* The primitive type {@code float}. |
|
75 |
*/ |
|
76 |
FLOAT, |
|
77 |
||
78 |
/** |
|
79 |
* The primitive type {@code double}. |
|
80 |
*/ |
|
81 |
DOUBLE, |
|
82 |
||
83 |
/** |
|
84 |
* The pseudo-type corresponding to the keyword {@code void}. |
|
85 |
* @see NoType |
|
86 |
*/ |
|
87 |
VOID, |
|
88 |
||
89 |
/** |
|
90 |
* A pseudo-type used where no actual type is appropriate. |
|
91 |
* @see NoType |
|
92 |
*/ |
|
93 |
NONE, |
|
94 |
||
95 |
/** |
|
96 |
* The null type. |
|
97 |
*/ |
|
98 |
NULL, |
|
99 |
||
100 |
/** |
|
101 |
* An array type. |
|
102 |
*/ |
|
103 |
ARRAY, |
|
104 |
||
105 |
/** |
|
106 |
* A class or interface type. |
|
107 |
*/ |
|
108 |
DECLARED, |
|
109 |
||
110 |
/** |
|
111 |
* A class or interface type that could not be resolved. |
|
112 |
*/ |
|
113 |
ERROR, |
|
114 |
||
115 |
/** |
|
116 |
* A type variable. |
|
117 |
*/ |
|
118 |
TYPEVAR, |
|
119 |
||
120 |
/** |
|
121 |
* A wildcard type argument. |
|
122 |
*/ |
|
123 |
WILDCARD, |
|
124 |
||
125 |
/** |
|
126 |
* A pseudo-type corresponding to a package element. |
|
127 |
* @see NoType |
|
128 |
*/ |
|
129 |
PACKAGE, |
|
130 |
||
131 |
/** |
|
132 |
* A method, constructor, or initializer. |
|
133 |
*/ |
|
134 |
EXECUTABLE, |
|
135 |
||
136 |
/** |
|
137 |
* An implementation-reserved type. |
|
138 |
* This is not the type you are looking for. |
|
139 |
*/ |
|
8235
0f7e1f7a6a4b
6961571: Update visitors to support ARM's ElementKind.RESOURCE_VARIABLE
darcy
parents:
5520
diff
changeset
|
140 |
OTHER, |
0f7e1f7a6a4b
6961571: Update visitors to support ARM's ElementKind.RESOURCE_VARIABLE
darcy
parents:
5520
diff
changeset
|
141 |
|
0f7e1f7a6a4b
6961571: Update visitors to support ARM's ElementKind.RESOURCE_VARIABLE
darcy
parents:
5520
diff
changeset
|
142 |
/** |
9300
c2de4dd9853b
7033809: Rename "disjunctive" to "union" in javax.lang.model
darcy
parents:
8235
diff
changeset
|
143 |
* A union type. |
8235
0f7e1f7a6a4b
6961571: Update visitors to support ARM's ElementKind.RESOURCE_VARIABLE
darcy
parents:
5520
diff
changeset
|
144 |
* |
0f7e1f7a6a4b
6961571: Update visitors to support ARM's ElementKind.RESOURCE_VARIABLE
darcy
parents:
5520
diff
changeset
|
145 |
* @since 1.7 |
0f7e1f7a6a4b
6961571: Update visitors to support ARM's ElementKind.RESOURCE_VARIABLE
darcy
parents:
5520
diff
changeset
|
146 |
*/ |
9300
c2de4dd9853b
7033809: Rename "disjunctive" to "union" in javax.lang.model
darcy
parents:
8235
diff
changeset
|
147 |
UNION; |
10 | 148 |
|
149 |
/** |
|
150 |
* Returns {@code true} if this kind corresponds to a primitive |
|
151 |
* type and {@code false} otherwise. |
|
152 |
* @return {@code true} if this kind corresponds to a primitive type |
|
153 |
*/ |
|
154 |
public boolean isPrimitive() { |
|
155 |
switch(this) { |
|
156 |
case BOOLEAN: |
|
157 |
case BYTE: |
|
158 |
case SHORT: |
|
159 |
case INT: |
|
160 |
case LONG: |
|
161 |
case CHAR: |
|
162 |
case FLOAT: |
|
163 |
case DOUBLE: |
|
164 |
return true; |
|
165 |
||
166 |
default: |
|
167 |
return false; |
|
168 |
} |
|
169 |
} |
|
170 |
} |