src/share/classes/com/sun/tools/javadoc/PrimitiveType.java

Tue, 09 Oct 2012 19:10:00 -0700

author
jjg
date
Tue, 09 Oct 2012 19:10:00 -0700
changeset 1357
c75be5bc5283
parent 554
9d9f26857129
child 1359
25e14ad23cef
permissions
-rw-r--r--

8000663: clean up langtools imports
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 2001, 2012, 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 com.sun.tools.javadoc;
    28 import com.sun.javadoc.*;
    30 class PrimitiveType implements com.sun.javadoc.Type {
    32     private final String name;
    34     static final PrimitiveType voidType = new PrimitiveType("void");
    35     static final PrimitiveType booleanType = new PrimitiveType("boolean");
    36     static final PrimitiveType byteType = new PrimitiveType("byte");
    37     static final PrimitiveType charType = new PrimitiveType("char");
    38     static final PrimitiveType shortType = new PrimitiveType("short");
    39     static final PrimitiveType intType = new PrimitiveType("int");
    40     static final PrimitiveType longType = new PrimitiveType("long");
    41     static final PrimitiveType floatType = new PrimitiveType("float");
    42     static final PrimitiveType doubleType = new PrimitiveType("double");
    44     // error type, should never actually be used
    45     static final PrimitiveType errorType = new PrimitiveType("");
    47     PrimitiveType(String name) {
    48         this.name = name;
    49     }
    51     /**
    52      * Return unqualified name of type excluding any dimension information.
    53      * <p>
    54      * For example, a two dimensional array of String returns 'String'.
    55      */
    56     public String typeName() {
    57         return name;
    58     }
    60     /**
    61      * Return qualified name of type excluding any dimension information.
    62      *<p>
    63      * For example, a two dimensional array of String
    64      * returns 'java.lang.String'.
    65      */
    66     public String qualifiedTypeName() {
    67         return name;
    68     }
    70     /**
    71      * Return the simple name of this type.
    72      */
    73     public String simpleTypeName() {
    74         return name;
    75     }
    77     /**
    78      * Return the type's dimension information, as a string.
    79      * <p>
    80      * For example, a two dimensional array of String returns '[][]'.
    81      */
    82     public String dimension() {
    83         return "";
    84     }
    86     /**
    87      * Return this type as a class.  Array dimensions are ignored.
    88      *
    89      * @return a ClassDocImpl if the type is a Class.
    90      * Return null if it is a primitive type..
    91      */
    92     public ClassDoc asClassDoc() {
    93         return null;
    94     }
    96     /**
    97      * Return null, as this is not an annotation type.
    98      */
    99     public AnnotationTypeDoc asAnnotationTypeDoc() {
   100         return null;
   101     }
   103     /**
   104      * Return null, as this is not an instantiation.
   105      */
   106     public ParameterizedType asParameterizedType() {
   107         return null;
   108     }
   110     /**
   111      * Return null, as this is not a type variable.
   112      */
   113     public TypeVariable asTypeVariable() {
   114         return null;
   115     }
   117     /**
   118      * Return null, as this is not a wildcard type;
   119      */
   120     public WildcardType asWildcardType() {
   121         return null;
   122     }
   124     /**
   125      * Returns a string representation of the type.
   126      *
   127      * Return name of type including any dimension information.
   128      * <p>
   129      * For example, a two dimensional array of String returns
   130      * <code>String[][]</code>.
   131      *
   132      * @return name of type including any dimension information.
   133      */
   134     public String toString() {
   135         return qualifiedTypeName();
   136     }
   138     /**
   139      * Return true if this is a primitive type.
   140      */
   141     public boolean isPrimitive() {
   142         return true;
   143     }
   144 }

mercurial