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

Sun, 17 Feb 2013 16:44:55 -0500

author
dholmes
date
Sun, 17 Feb 2013 16:44:55 -0500
changeset 1571
af8417e590f4
parent 1521
71f35e4b93a5
child 1691
f10cffab99b4
permissions
-rw-r--r--

Merge

     1 /*
     2  * Copyright (c) 2001, 2013, 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 /**
    31  *  <p><b>This is NOT part of any supported API.
    32  *  If you write code that depends on this, you do so at your own risk.
    33  *  This code and its internal interfaces are subject to change or
    34  *  deletion without notice.</b>
    35  */
    36 class PrimitiveType implements com.sun.javadoc.Type {
    38     private final String name;
    40     static final PrimitiveType voidType = new PrimitiveType("void");
    41     static final PrimitiveType booleanType = new PrimitiveType("boolean");
    42     static final PrimitiveType byteType = new PrimitiveType("byte");
    43     static final PrimitiveType charType = new PrimitiveType("char");
    44     static final PrimitiveType shortType = new PrimitiveType("short");
    45     static final PrimitiveType intType = new PrimitiveType("int");
    46     static final PrimitiveType longType = new PrimitiveType("long");
    47     static final PrimitiveType floatType = new PrimitiveType("float");
    48     static final PrimitiveType doubleType = new PrimitiveType("double");
    50     // error type, should never actually be used
    51     static final PrimitiveType errorType = new PrimitiveType("");
    53     PrimitiveType(String name) {
    54         this.name = name;
    55     }
    57     /**
    58      * Return unqualified name of type excluding any dimension information.
    59      * <p>
    60      * For example, a two dimensional array of String returns 'String'.
    61      */
    62     public String typeName() {
    63         return name;
    64     }
    66     /**
    67      * Return qualified name of type excluding any dimension information.
    68      *<p>
    69      * For example, a two dimensional array of String
    70      * returns 'java.lang.String'.
    71      */
    72     public String qualifiedTypeName() {
    73         return name;
    74     }
    76     /**
    77      * Return the simple name of this type.
    78      */
    79     public String simpleTypeName() {
    80         return name;
    81     }
    83     /**
    84      * Return the type's dimension information, as a string.
    85      * <p>
    86      * For example, a two dimensional array of String returns '[][]'.
    87      */
    88     public String dimension() {
    89         return "";
    90     }
    92     /**
    93      * Return this type as a class.  Array dimensions are ignored.
    94      *
    95      * @return a ClassDocImpl if the type is a Class.
    96      * Return null if it is a primitive type..
    97      */
    98     public ClassDoc asClassDoc() {
    99         return null;
   100     }
   102     /**
   103      * Return null, as this is not an annotation type.
   104      */
   105     public AnnotationTypeDoc asAnnotationTypeDoc() {
   106         return null;
   107     }
   109     /**
   110      * Return null, as this is not an instantiation.
   111      */
   112     public ParameterizedType asParameterizedType() {
   113         return null;
   114     }
   116     /**
   117      * Return null, as this is not a type variable.
   118      */
   119     public TypeVariable asTypeVariable() {
   120         return null;
   121     }
   123     /**
   124      * Return null, as this is not a wildcard type.
   125      */
   126     public WildcardType asWildcardType() {
   127         return null;
   128     }
   130     /**
   131      * Return null, as this is not an annotated type.
   132      */
   133     public AnnotatedType asAnnotatedType() {
   134         return null;
   135     }
   137     /**
   138      * Returns a string representation of the type.
   139      *
   140      * Return name of type including any dimension information.
   141      * <p>
   142      * For example, a two dimensional array of String returns
   143      * <code>String[][]</code>.
   144      *
   145      * @return name of type including any dimension information.
   146      */
   147     public String toString() {
   148         return qualifiedTypeName();
   149     }
   151     /**
   152      * Return true if this is a primitive type.
   153      */
   154     public boolean isPrimitive() {
   155         return true;
   156     }
   157 }

mercurial