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

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1
9a66ca7c79fa
child 554
9d9f26857129
permissions
-rw-r--r--

Initial load

duke@1 1 /*
duke@1 2 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation. Sun designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
duke@1 9 * by Sun in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
duke@1 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 * have any questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.javadoc;
duke@1 27
duke@1 28 /**
duke@1 29 * Represents a type. A type can be a class or interface, an
duke@1 30 * invocation (like {@code List<String>}) of a generic class or interface,
duke@1 31 * a type variable, a wildcard type ("<code>?</code>"),
duke@1 32 * or a primitive data type (like <code>char</code>).
duke@1 33 *
duke@1 34 * @since 1.2
duke@1 35 * @author Kaiyang Liu (original)
duke@1 36 * @author Robert Field (rewrite)
duke@1 37 * @author Scott Seligman (generics)
duke@1 38 */
duke@1 39 public interface Type {
duke@1 40
duke@1 41 /**
duke@1 42 * Return unqualified name of type excluding any dimension information.
duke@1 43 * <p>
duke@1 44 * For example, a two dimensional array of String returns
duke@1 45 * "<code>String</code>".
duke@1 46 */
duke@1 47 String typeName();
duke@1 48
duke@1 49 /**
duke@1 50 * Return qualified name of type excluding any dimension information.
duke@1 51 *<p>
duke@1 52 * For example, a two dimensional array of String
duke@1 53 * returns "<code>java.lang.String</code>".
duke@1 54 */
duke@1 55 String qualifiedTypeName();
duke@1 56
duke@1 57 /**
duke@1 58 * Return the simple name of this type excluding any dimension information.
duke@1 59 * This is the unqualified name of the type, except that for nested types
duke@1 60 * only the identifier of the innermost type is included.
duke@1 61 * <p>
duke@1 62 * For example, the class {@code Outer.Inner} returns
duke@1 63 * "<code>Inner</code>".
duke@1 64 *
duke@1 65 * @since 1.5
duke@1 66 */
duke@1 67 String simpleTypeName();
duke@1 68
duke@1 69 /**
duke@1 70 * Return the type's dimension information, as a string.
duke@1 71 * <p>
duke@1 72 * For example, a two dimensional array of String returns
duke@1 73 * "<code>[][]</code>".
duke@1 74 */
duke@1 75 String dimension();
duke@1 76
duke@1 77 /**
duke@1 78 * Return a string representation of the type.
duke@1 79 * This includes any dimension information and type arguments.
duke@1 80 * <p>
duke@1 81 * For example, a two dimensional array of String may return
duke@1 82 * "<code>java.lang.String[][]</code>",
duke@1 83 * and the parameterized type {@code List<Integer>} may return
duke@1 84 * "{@code java.util.List<java.lang.Integer>}".
duke@1 85 *
duke@1 86 * @return a string representation of the type.
duke@1 87 */
duke@1 88 String toString();
duke@1 89
duke@1 90 /**
duke@1 91 * Return true if this type represents a primitive type.
duke@1 92 *
duke@1 93 * @return true if this type represents a primitive type.
duke@1 94 * @since 1.5
duke@1 95 */
duke@1 96 boolean isPrimitive();
duke@1 97
duke@1 98 /**
duke@1 99 * Return this type as a <code>ClassDoc</code> if it represents a class
duke@1 100 * or interface. Array dimensions are ignored.
duke@1 101 * If this type is a <code>ParameterizedType</code>,
duke@1 102 * <code>TypeVariable</code>, or <code>WildcardType</code>, return
duke@1 103 * the <code>ClassDoc</code> of the type's erasure. If this is an
duke@1 104 * <code>AnnotationTypeDoc</code>, return this as a <code>ClassDoc</code>
duke@1 105 * (but see {@link #asAnnotationTypeDoc()}).
duke@1 106 * If this is a primitive type, return null.
duke@1 107 *
duke@1 108 * @return the <code>ClassDoc</code> of this type,
duke@1 109 * or null if it is a primitive type.
duke@1 110 */
duke@1 111 ClassDoc asClassDoc();
duke@1 112
duke@1 113 /**
duke@1 114 * Return this type as a <code>ParameterizedType</code> if it represents
duke@1 115 * an invocation of a generic class or interface. Array dimensions
duke@1 116 * are ignored.
duke@1 117 *
duke@1 118 * @return a <code>ParameterizedType</code> if the type is an
duke@1 119 * invocation of a generic type, or null if it is not.
duke@1 120 * @since 1.5
duke@1 121 */
duke@1 122 ParameterizedType asParameterizedType();
duke@1 123
duke@1 124 /**
duke@1 125 * Return this type as a <code>TypeVariable</code> if it represents
duke@1 126 * a type variable. Array dimensions are ignored.
duke@1 127 *
duke@1 128 * @return a <code>TypeVariable</code> if the type is a type variable,
duke@1 129 * or null if it is not.
duke@1 130 * @since 1.5
duke@1 131 */
duke@1 132 TypeVariable asTypeVariable();
duke@1 133
duke@1 134 /**
duke@1 135 * Return this type as a <code>WildcardType</code> if it represents
duke@1 136 * a wildcard type.
duke@1 137 *
duke@1 138 * @return a <code>WildcardType</code> if the type is a wildcard type,
duke@1 139 * or null if it is not.
duke@1 140 * @since 1.5
duke@1 141 */
duke@1 142 WildcardType asWildcardType();
duke@1 143
duke@1 144 /**
duke@1 145 * Return this type as an <code>AnnotationTypeDoc</code> if it represents
duke@1 146 * an annotation type. Array dimensions are ignored.
duke@1 147 *
duke@1 148 * @return an <code>AnnotationTypeDoc</code> if the type is an annotation
duke@1 149 * type, or null if it is not.
duke@1 150 * @since 1.5
duke@1 151 */
duke@1 152 AnnotationTypeDoc asAnnotationTypeDoc();
duke@1 153 }

mercurial