src/share/classes/javax/lang/model/type/TypeKind.java

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1
9a66ca7c79fa
child 554
9d9f26857129
permissions
-rw-r--r--

Initial load

     1 /*
     2  * Copyright 2005-2006 Sun Microsystems, Inc.  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.  Sun designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Sun in the LICENSE file that accompanied this code.
    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  *
    21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
    23  * have any questions.
    24  */
    26 package javax.lang.model.type;
    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&trade; programming language.
    35  *
    36  * @author Joseph D. Darcy
    37  * @author Scott Seligman
    38  * @author Peter von der Ah&eacute;
    39  * @see TypeMirror
    40  * @since 1.6
    41  */
    42 public enum TypeKind {
    43     /**
    44      * The primitive type {@code boolean}.
    45      */
    46     BOOLEAN,
    48     /**
    49      * The primitive type {@code byte}.
    50      */
    51     BYTE,
    53     /**
    54      * The primitive type {@code short}.
    55      */
    56     SHORT,
    58     /**
    59      * The primitive type {@code int}.
    60      */
    61     INT,
    63     /**
    64      * The primitive type {@code long}.
    65      */
    66     LONG,
    68     /**
    69      * The primitive type {@code char}.
    70      */
    71     CHAR,
    73     /**
    74      * The primitive type {@code float}.
    75      */
    76     FLOAT,
    78     /**
    79      * The primitive type {@code double}.
    80      */
    81     DOUBLE,
    83     /**
    84      * The pseudo-type corresponding to the keyword {@code void}.
    85      * @see NoType
    86      */
    87     VOID,
    89     /**
    90      * A pseudo-type used where no actual type is appropriate.
    91      * @see NoType
    92      */
    93     NONE,
    95     /**
    96      * The null type.
    97      */
    98     NULL,
   100     /**
   101      * An array type.
   102      */
   103     ARRAY,
   105     /**
   106      * A class or interface type.
   107      */
   108     DECLARED,
   110     /**
   111      * A class or interface type that could not be resolved.
   112      */
   113     ERROR,
   115     /**
   116      * A type variable.
   117      */
   118     TYPEVAR,
   120     /**
   121      * A wildcard type argument.
   122      */
   123     WILDCARD,
   125     /**
   126      * A pseudo-type corresponding to a package element.
   127      * @see NoType
   128      */
   129     PACKAGE,
   131     /**
   132      * A method, constructor, or initializer.
   133      */
   134     EXECUTABLE,
   136     /**
   137      * An implementation-reserved type.
   138      * This is not the type you are looking for.
   139      */
   140     OTHER;
   142     /**
   143      * Returns {@code true} if this kind corresponds to a primitive
   144      * type and {@code false} otherwise.
   145      * @return {@code true} if this kind corresponds to a primitive type
   146      */
   147     public boolean isPrimitive() {
   148         switch(this) {
   149         case BOOLEAN:
   150         case BYTE:
   151         case SHORT:
   152         case INT:
   153         case LONG:
   154         case CHAR:
   155         case FLOAT:
   156         case DOUBLE:
   157             return true;
   159         default:
   160             return false;
   161         }
   162     }
   163 }

mercurial