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

Wed, 06 Apr 2011 19:30:57 -0700

author
darcy
date
Wed, 06 Apr 2011 19:30:57 -0700
changeset 969
8cc5b440fdde
parent 851
cad51b6eb7a6
child 1436
f6f1fd261f57
permissions
-rw-r--r--

7033809: Rename "disjunctive" to "union" in javax.lang.model
Reviewed-by: mcimadamore, jjg

     1 /*
     2  * Copyright (c) 2005, 2011, 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.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle 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 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.
    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       * A union type.
   144       *
   145       * @since 1.7
   146       */
   147     UNION;
   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;
   166         default:
   167             return false;
   168         }
   169     }
   170 }

mercurial