1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/javax/lang/model/type/TypeKind.java Wed Apr 27 01:34:52 2016 +0800 1.3 @@ -0,0 +1,177 @@ 1.4 +/* 1.5 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package javax.lang.model.type; 1.30 + 1.31 + 1.32 +/** 1.33 + * The kind of a type mirror. 1.34 + * 1.35 + * <p>Note that it is possible additional type kinds will be added to 1.36 + * accommodate new, currently unknown, language structures added to 1.37 + * future versions of the Java™ programming language. 1.38 + * 1.39 + * @author Joseph D. Darcy 1.40 + * @author Scott Seligman 1.41 + * @author Peter von der Ahé 1.42 + * @see TypeMirror 1.43 + * @since 1.6 1.44 + */ 1.45 +public enum TypeKind { 1.46 + /** 1.47 + * The primitive type {@code boolean}. 1.48 + */ 1.49 + BOOLEAN, 1.50 + 1.51 + /** 1.52 + * The primitive type {@code byte}. 1.53 + */ 1.54 + BYTE, 1.55 + 1.56 + /** 1.57 + * The primitive type {@code short}. 1.58 + */ 1.59 + SHORT, 1.60 + 1.61 + /** 1.62 + * The primitive type {@code int}. 1.63 + */ 1.64 + INT, 1.65 + 1.66 + /** 1.67 + * The primitive type {@code long}. 1.68 + */ 1.69 + LONG, 1.70 + 1.71 + /** 1.72 + * The primitive type {@code char}. 1.73 + */ 1.74 + CHAR, 1.75 + 1.76 + /** 1.77 + * The primitive type {@code float}. 1.78 + */ 1.79 + FLOAT, 1.80 + 1.81 + /** 1.82 + * The primitive type {@code double}. 1.83 + */ 1.84 + DOUBLE, 1.85 + 1.86 + /** 1.87 + * The pseudo-type corresponding to the keyword {@code void}. 1.88 + * @see NoType 1.89 + */ 1.90 + VOID, 1.91 + 1.92 + /** 1.93 + * A pseudo-type used where no actual type is appropriate. 1.94 + * @see NoType 1.95 + */ 1.96 + NONE, 1.97 + 1.98 + /** 1.99 + * The null type. 1.100 + */ 1.101 + NULL, 1.102 + 1.103 + /** 1.104 + * An array type. 1.105 + */ 1.106 + ARRAY, 1.107 + 1.108 + /** 1.109 + * A class or interface type. 1.110 + */ 1.111 + DECLARED, 1.112 + 1.113 + /** 1.114 + * A class or interface type that could not be resolved. 1.115 + */ 1.116 + ERROR, 1.117 + 1.118 + /** 1.119 + * A type variable. 1.120 + */ 1.121 + TYPEVAR, 1.122 + 1.123 + /** 1.124 + * A wildcard type argument. 1.125 + */ 1.126 + WILDCARD, 1.127 + 1.128 + /** 1.129 + * A pseudo-type corresponding to a package element. 1.130 + * @see NoType 1.131 + */ 1.132 + PACKAGE, 1.133 + 1.134 + /** 1.135 + * A method, constructor, or initializer. 1.136 + */ 1.137 + EXECUTABLE, 1.138 + 1.139 + /** 1.140 + * An implementation-reserved type. 1.141 + * This is not the type you are looking for. 1.142 + */ 1.143 + OTHER, 1.144 + 1.145 + /** 1.146 + * A union type. 1.147 + * 1.148 + * @since 1.7 1.149 + */ 1.150 + UNION, 1.151 + 1.152 + /** 1.153 + * An intersection type. 1.154 + * 1.155 + * @since 1.8 1.156 + */ 1.157 + INTERSECTION; 1.158 + 1.159 + /** 1.160 + * Returns {@code true} if this kind corresponds to a primitive 1.161 + * type and {@code false} otherwise. 1.162 + * @return {@code true} if this kind corresponds to a primitive type 1.163 + */ 1.164 + public boolean isPrimitive() { 1.165 + switch(this) { 1.166 + case BOOLEAN: 1.167 + case BYTE: 1.168 + case SHORT: 1.169 + case INT: 1.170 + case LONG: 1.171 + case CHAR: 1.172 + case FLOAT: 1.173 + case DOUBLE: 1.174 + return true; 1.175 + 1.176 + default: 1.177 + return false; 1.178 + } 1.179 + } 1.180 +}