KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > type > TypeKind


1 /*
2  * @(#)TypeKind.java 1.5 06/07/11
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.lang.model.type;
9
10
11 /**
12  * The kind of a type mirror.
13  *
14  * <p>Note that it is possible additional type kinds will be added to
15  * accommodate new, currently unknown, language structures added to
16  * future versions of the Java&trade; programming language.
17  *
18  * @author Joseph D. Darcy
19  * @author Scott Seligman
20  * @author Peter von der Ah&eacute;
21  * @version 1.5 06/07/11
22  * @see TypeMirror
23  * @since 1.6
24  */

25 public enum TypeKind {
26     /**
27      * The primitive type {@code boolean}.
28      */

29     BOOLEAN,
30
31     /**
32      * The primitive type {@code byte}.
33      */

34     BYTE,
35
36     /**
37      * The primitive type {@code short}.
38      */

39     SHORT,
40
41     /**
42      * The primitive type {@code int}.
43      */

44     INT,
45
46     /**
47      * The primitive type {@code long}.
48      */

49     LONG,
50
51     /**
52      * The primitive type {@code char}.
53      */

54     CHAR,
55
56     /**
57      * The primitive type {@code float}.
58      */

59     FLOAT,
60
61     /**
62      * The primitive type {@code double}.
63      */

64     DOUBLE,
65
66     /**
67      * The pseudo-type corresponding to the keyword {@code void}.
68      * @see NoType
69      */

70     VOID,
71
72     /**
73      * A pseudo-type used where no actual type is appropriate.
74      * @see NoType
75      */

76     NONE,
77
78     /**
79      * The null type.
80      */

81     NULL,
82
83     /**
84      * An array type.
85      */

86     ARRAY,
87
88     /**
89      * A class or interface type.
90      */

91     DECLARED,
92
93     /**
94      * A class or interface type that could not be resolved.
95      */

96     ERROR,
97
98     /**
99      * A type variable.
100      */

101     TYPEVAR,
102
103     /**
104      * A wildcard type argument.
105      */

106     WILDCARD,
107
108     /**
109      * A pseudo-type corresponding to a package element.
110      * @see NoType
111      */

112     PACKAGE,
113
114     /**
115      * A method, constructor, or initializer.
116      */

117     EXECUTABLE,
118
119     /**
120      * An implementation-reserved type.
121      * This is not the type you are looking for.
122      */

123     OTHER;
124
125     /**
126      * Returns {@code true} if this kind corresponds to a primitive
127      * type and {@code false} otherwise.
128      * @return {@code true} if this kind corresponds to a primitive type
129      */

130     public boolean isPrimitive() {
131     switch(this) {
132     case BOOLEAN:
133     case BYTE:
134     case SHORT:
135     case INT:
136     case LONG:
137     case CHAR:
138     case FLOAT:
139     case DOUBLE:
140         return true;
141         
142     default:
143         return false;
144     }
145     }
146 }
147
Popular Tags