src/share/classes/com/sun/javadoc/Type.java

Tue, 24 Dec 2013 09:17:37 -0800

author
ksrini
date
Tue, 24 Dec 2013 09:17:37 -0800
changeset 2227
998b10c43157
parent 1691
f10cffab99b4
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8029230: Update copyright year to match last edit in jdk8 langtools repository for 2013
Reviewed-by: ksrini
Contributed-by: steve.sides@oracle.com

     1 /*
     2  * Copyright (c) 1997, 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.javadoc;
    28 /**
    29  * Represents a type.  A type can be a class or interface, an
    30  * invocation (like {@code List<String>}) of a generic class or interface,
    31  * a type variable, a wildcard type ("<code>?</code>"),
    32  * or a primitive data type (like <code>char</code>).
    33  *
    34  * @since 1.2
    35  * @author Kaiyang Liu (original)
    36  * @author Robert Field (rewrite)
    37  * @author Scott Seligman (generics)
    38  */
    39 public interface Type {
    41     /**
    42      * Return unqualified name of type excluding any dimension information.
    43      * <p>
    44      * For example, a two dimensional array of String returns
    45      * "<code>String</code>".
    46      */
    47     String typeName();
    49     /**
    50      * Return qualified name of type excluding any dimension information.
    51      *<p>
    52      * For example, a two dimensional array of String
    53      * returns "<code>java.lang.String</code>".
    54      */
    55     String qualifiedTypeName();
    57     /**
    58      * Return the simple name of this type excluding any dimension information.
    59      * This is the unqualified name of the type, except that for nested types
    60      * only the identifier of the innermost type is included.
    61      * <p>
    62      * For example, the class {@code Outer.Inner} returns
    63      * "<code>Inner</code>".
    64      *
    65      * @since 1.5
    66      */
    67     String simpleTypeName();
    69     /**
    70      * Return the type's dimension information, as a string.
    71      * <p>
    72      * For example, a two dimensional array of String returns
    73      * "<code>[][]</code>".
    74      */
    75     String dimension();
    77     /**
    78      * Return a string representation of the type.
    79      * This includes any dimension information and type arguments.
    80      * <p>
    81      * For example, a two dimensional array of String may return
    82      * "<code>java.lang.String[][]</code>",
    83      * and the parameterized type {@code List<Integer>} may return
    84      * "{@code java.util.List<java.lang.Integer>}".
    85      *
    86      * @return a string representation of the type.
    87      */
    88     String toString();
    90     /**
    91      * Return true if this type represents a primitive type.
    92      *
    93      * @return true if this type represents a primitive type.
    94      * @since 1.5
    95      */
    96     boolean isPrimitive();
    98     /**
    99      * Return this type as a <code>ClassDoc</code> if it represents a class
   100      * or interface.  Array dimensions are ignored.
   101      * If this type is a <code>ParameterizedType</code>,
   102      * <code>TypeVariable</code>, or <code>WildcardType</code>, return
   103      * the <code>ClassDoc</code> of the type's erasure.  If this is an
   104      * <code>AnnotationTypeDoc</code>, return this as a <code>ClassDoc</code>
   105      * (but see {@link #asAnnotationTypeDoc()}).
   106      * If this is a primitive type, return null.
   107      *
   108      * @return the <code>ClassDoc</code> of this type,
   109      *         or null if it is a primitive type.
   110      */
   111     ClassDoc asClassDoc();
   113     /**
   114      * Return this type as a <code>ParameterizedType</code> if it represents
   115      * an invocation of a generic class or interface.  Array dimensions
   116      * are ignored.
   117      *
   118      * @return a <code>ParameterizedType</code> if the type is an
   119      *         invocation of a generic type, or null if it is not.
   120      * @since 1.5
   121      */
   122     ParameterizedType asParameterizedType();
   124     /**
   125      * Return this type as a <code>TypeVariable</code> if it represents
   126      * a type variable.  Array dimensions are ignored.
   127      *
   128      * @return a <code>TypeVariable</code> if the type is a type variable,
   129      *         or null if it is not.
   130      * @since 1.5
   131      */
   132     TypeVariable asTypeVariable();
   134     /**
   135      * Return this type as a <code>WildcardType</code> if it represents
   136      * a wildcard type.
   137      *
   138      * @return a <code>WildcardType</code> if the type is a wildcard type,
   139      *         or null if it is not.
   140      * @since 1.5
   141      */
   142     WildcardType asWildcardType();
   144     /**
   145      * Returns this type as a <code>AnnotatedType</code> if it represents
   146      * an annotated type.
   147      *
   148      * @return a <code>AnnotatedType</code> if the type if an annotated type,
   149      *         or null if it is not
   150      * @since 1.8
   151      */
   152     AnnotatedType asAnnotatedType();
   154     /**
   155      * Return this type as an <code>AnnotationTypeDoc</code> if it represents
   156      * an annotation type.  Array dimensions are ignored.
   157      *
   158      * @return an <code>AnnotationTypeDoc</code> if the type is an annotation
   159      *         type, or null if it is not.
   160      * @since 1.5
   161      */
   162     AnnotationTypeDoc asAnnotationTypeDoc();
   164     /**
   165      * If this type is an array type, return the element type of the
   166      * array. Otherwise, return null.
   167      *
   168      * @return a <code>Type</code> representing the element type or null.
   169      * @since 1.8
   170      */
   171     Type getElementType();
   172 }

mercurial