langtools/src/share/classes/com/sun/javadoc/Type.java
author jjg
Mon, 03 Mar 2014 15:10:01 -0800
changeset 23136 aa8958a4c8f4
parent 16969 b58d8a70d921
permissions -rw-r--r--
8035877: javadoc classes are missing @return and @param tags Reviewed-by: jjg Contributed-by: neil.toda@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
     2
 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.javadoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 * Represents a type.  A type can be a class or interface, an
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
 * invocation (like {@code List<String>}) of a generic class or interface,
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    31
 * a type variable, a wildcard type ("{@code ?}"),
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    32
 * or a primitive data type (like {@code char}).
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * @since 1.2
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * @author Kaiyang Liu (original)
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * @author Robert Field (rewrite)
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * @author Scott Seligman (generics)
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
public interface Type {
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
     * Return unqualified name of type excluding any dimension information.
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
     * For example, a two dimensional array of String returns
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    45
     * "{@code String}".
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    46
     * @return unqualified name of type excluding any dimension information.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    String typeName();
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
     * Return qualified name of type excluding any dimension information.
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
     *<p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
     * For example, a two dimensional array of String
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    54
     * returns "{@code java.lang.String}".
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    55
     * @return qualified name of this type excluding any dimension information.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    String qualifiedTypeName();
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     * Return the simple name of this type excluding any dimension information.
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     * This is the unqualified name of the type, except that for nested types
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
     * only the identifier of the innermost type is included.
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
     * For example, the class {@code Outer.Inner} returns
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    65
     * "{@code Inner}".
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     * @since 1.5
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    68
     * @return the simple name of this type excluding any dimension information.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
    String simpleTypeName();
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     * Return the type's dimension information, as a string.
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * For example, a two dimensional array of String returns
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    76
     * "{@code [][]}".
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    77
     * @return the type's dimension information as a string.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    String dimension();
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     * Return a string representation of the type.
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     * This includes any dimension information and type arguments.
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * For example, a two dimensional array of String may return
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
    86
     * "{@code java.lang.String[][]}",
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     * and the parameterized type {@code List<Integer>} may return
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     * "{@code java.util.List<java.lang.Integer>}".
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     * @return a string representation of the type.
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    String toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
     * Return true if this type represents a primitive type.
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     * @return true if this type represents a primitive type.
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    boolean isPrimitive();
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    /**
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   103
     * Return this type as a {@code ClassDoc} if it represents a class
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     * or interface.  Array dimensions are ignored.
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   105
     * If this type is a {@code ParameterizedType},
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   106
     * {@code TypeVariable}, or {@code WildcardType}, return
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   107
     * the {@code ClassDoc} of the type's erasure.  If this is an
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   108
     * {@code AnnotationTypeDoc}, return this as a {@code ClassDoc}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * (but see {@link #asAnnotationTypeDoc()}).
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * If this is a primitive type, return null.
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     *
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   112
     * @return the {@code ClassDoc} of this type,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     *         or null if it is a primitive type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    ClassDoc asClassDoc();
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    /**
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   118
     * Return this type as a {@code ParameterizedType} if it represents
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     * an invocation of a generic class or interface.  Array dimensions
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     * are ignored.
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     *
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   122
     * @return a {@code ParameterizedType} if the type is an
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
     *         invocation of a generic type, or null if it is not.
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
     * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
    ParameterizedType asParameterizedType();
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    /**
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   129
     * Return this type as a {@code TypeVariable} if it represents
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * a type variable.  Array dimensions are ignored.
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     *
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   132
     * @return a {@code TypeVariable} if the type is a type variable,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     *         or null if it is not.
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
    TypeVariable asTypeVariable();
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    /**
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   139
     * Return this type as a {@code WildcardType} if it represents
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * a wildcard type.
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     *
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   142
     * @return a {@code WildcardType} if the type is a wildcard type,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     *         or null if it is not.
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
    WildcardType asWildcardType();
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    /**
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   149
     * Returns this type as a {@code AnnotatedType} if it represents
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 5520
diff changeset
   150
     * an annotated type.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 5520
diff changeset
   151
     *
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   152
     * @return a {@code AnnotatedType} if the type if an annotated type,
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 5520
diff changeset
   153
     *         or null if it is not
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 5520
diff changeset
   154
     * @since 1.8
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 5520
diff changeset
   155
     */
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 5520
diff changeset
   156
    AnnotatedType asAnnotatedType();
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 5520
diff changeset
   157
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 5520
diff changeset
   158
    /**
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   159
     * Return this type as an {@code AnnotationTypeDoc} if it represents
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     * an annotation type.  Array dimensions are ignored.
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     *
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   162
     * @return an {@code AnnotationTypeDoc} if the type is an annotation
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     *         type, or null if it is not.
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
     * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
    AnnotationTypeDoc asAnnotationTypeDoc();
16969
b58d8a70d921 8009686: Generated javadoc documentation should be able to display type annotation on an array
bpatel
parents: 15385
diff changeset
   167
b58d8a70d921 8009686: Generated javadoc documentation should be able to display type annotation on an array
bpatel
parents: 15385
diff changeset
   168
    /**
b58d8a70d921 8009686: Generated javadoc documentation should be able to display type annotation on an array
bpatel
parents: 15385
diff changeset
   169
     * If this type is an array type, return the element type of the
b58d8a70d921 8009686: Generated javadoc documentation should be able to display type annotation on an array
bpatel
parents: 15385
diff changeset
   170
     * array. Otherwise, return null.
b58d8a70d921 8009686: Generated javadoc documentation should be able to display type annotation on an array
bpatel
parents: 15385
diff changeset
   171
     *
23136
aa8958a4c8f4 8035877: javadoc classes are missing @return and @param tags
jjg
parents: 16969
diff changeset
   172
     * @return a {@code Type} representing the element type or null.
16969
b58d8a70d921 8009686: Generated javadoc documentation should be able to display type annotation on an array
bpatel
parents: 15385
diff changeset
   173
     * @since 1.8
b58d8a70d921 8009686: Generated javadoc documentation should be able to display type annotation on an array
bpatel
parents: 15385
diff changeset
   174
     */
b58d8a70d921 8009686: Generated javadoc documentation should be able to display type annotation on an array
bpatel
parents: 15385
diff changeset
   175
    Type getElementType();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
}