Java 编译器代码定义的 Java语言的类型 Types

Java 编译器代码定义的 Java语言的类型 Types

/*
 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.

 */

package javax.lang.model.type;


/**
 * The kind of a type mirror.
 *
 * <p>Note that it is possible additional type kinds will be added to
 * accommodate new, currently unknown, language structures added to
 * future versions of the Java™ programming language.
 *
 * @author Joseph D. Darcy
 * @author Scott Seligman
 * @author Peter von der Ahé
 * @see TypeMirror
 * @since 1.6
 */
public enum TypeKind {
    /**
     * The primitive type {@code boolean}.
     */
    BOOLEAN,

    /**
     * The primitive type {@code byte}.
     */
    BYTE,

    /**
     * The primitive type {@code short}.
     */
    SHORT,

    /**
     * The primitive type {@code int}.
     */
    INT,

    /**
     * The primitive type {@code long}.
     */
    LONG,

    /**
     * The primitive type {@code char}.
     */
    CHAR,

    /**
     * The primitive type {@code float}.
     */
    FLOAT,

    /**
     * The primitive type {@code double}.
     */
    DOUBLE,

    /**
     * The pseudo-type corresponding to the keyword {@code void}.
     * @see NoType
     */
    VOID,

    /**
     * A pseudo-type used where no actual type is appropriate.
     * @see NoType
     */
    NONE,

    /**
     * The null type.
     */
    NULL,

    /**
     * An array type.
     */
    ARRAY,

    /**
     * A class or interface type.
     */
    DECLARED,

    /**
     * A class or interface type that could not be resolved.
     */
    ERROR,

    /**
     * A type variable.
     */
    TYPEVAR,

    /**
     * A wildcard type argument.
     */
    WILDCARD,

    /**
     * A pseudo-type corresponding to a package element.
     * @see NoType
     */
    PACKAGE,

    /**
     * A method, constructor, or initializer.
     */
    EXECUTABLE,

    /**
     * An implementation-reserved type.
     * This is not the type you are looking for.
     */
    OTHER,

    /**
      * A union type.
      *
      * @since 1.7
      */
    UNION,

    /**
      * An intersection type.
      *
      * @since 1.8
      */
    INTERSECTION;

    /**
     * Returns {@code true} if this kind corresponds to a primitive
     * type and {@code false} otherwise.
     * @return {@code true} if this kind corresponds to a primitive type
     */
    public boolean isPrimitive() {
        switch(this) {
        case BOOLEAN:
        case BYTE:
        case SHORT:
        case INT:
        case LONG:
        case CHAR:
        case FLOAT:
        case DOUBLE:
            return true;

        default:
            return false;
        }
    }
}

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏ml

HDUOJ1086You can Solve a Geometry Problem too

You can Solve a Geometry Problem too Time Limit: 2000/1000 MS (Java/Others)    M...

2686
来自专栏别先生

Encountered IOException running import job: org.apache.hadoop.mapred.FileAlreadyExistsException: Out

2273
来自专栏c#开发者

GoogleMaps api for javascript demo 动态按顺序加载marker

@{ } <!DOCTYPE html> <html lang="zh"> <head> <meta name="view...

2896
来自专栏Netkiller

String boot with Apache kafka 完整的发布订阅例子

本文节选自电子书《Netkiller Java 手札》地址 http://www.netkiller.cn/ 5.21.7. 完整的发布订阅实例 上面的例子仅仅...

3616
来自专栏Hongten

Hibernate4Maven

How to create a Maven project with Hibernate libs?

1653
来自专栏大数据智能实战

Attention is all you need新翻译架构的测试

翻译的进展真是很快,如近日,谷歌再次宣布又在机器翻译上更进了一步,实现了完全基于 attention 的 Transformer 机器翻译网络架构。这篇文章的...

4418
来自专栏算法修养

HOJ 1444 Humble Numbers

Humble Numbers My Tags (Edit) Source : University of Ulm Internal Contest ...

2947
来自专栏吴伟祥

Spring4 @Configuration源码

672
来自专栏算法修养

HOJ-1005 Fast Food(动态规划)

Fast Food My Tags (Edit) Source : Unknown Time limit : 3 sec Memory...

2847
来自专栏算法修养

HDU-1394 Minimum Inversion Number(线段树求逆序数)

Minimum Inversion Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit:...

3575

扫码关注云+社区

领取腾讯云代金券