1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/com/sun/javadoc/Type.java Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,153 @@ 1.4 +/* 1.5 + * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Sun designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Sun in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.26 + * have any questions. 1.27 + */ 1.28 + 1.29 +package com.sun.javadoc; 1.30 + 1.31 +/** 1.32 + * Represents a type. A type can be a class or interface, an 1.33 + * invocation (like {@code List<String>}) of a generic class or interface, 1.34 + * a type variable, a wildcard type ("<code>?</code>"), 1.35 + * or a primitive data type (like <code>char</code>). 1.36 + * 1.37 + * @since 1.2 1.38 + * @author Kaiyang Liu (original) 1.39 + * @author Robert Field (rewrite) 1.40 + * @author Scott Seligman (generics) 1.41 + */ 1.42 +public interface Type { 1.43 + 1.44 + /** 1.45 + * Return unqualified name of type excluding any dimension information. 1.46 + * <p> 1.47 + * For example, a two dimensional array of String returns 1.48 + * "<code>String</code>". 1.49 + */ 1.50 + String typeName(); 1.51 + 1.52 + /** 1.53 + * Return qualified name of type excluding any dimension information. 1.54 + *<p> 1.55 + * For example, a two dimensional array of String 1.56 + * returns "<code>java.lang.String</code>". 1.57 + */ 1.58 + String qualifiedTypeName(); 1.59 + 1.60 + /** 1.61 + * Return the simple name of this type excluding any dimension information. 1.62 + * This is the unqualified name of the type, except that for nested types 1.63 + * only the identifier of the innermost type is included. 1.64 + * <p> 1.65 + * For example, the class {@code Outer.Inner} returns 1.66 + * "<code>Inner</code>". 1.67 + * 1.68 + * @since 1.5 1.69 + */ 1.70 + String simpleTypeName(); 1.71 + 1.72 + /** 1.73 + * Return the type's dimension information, as a string. 1.74 + * <p> 1.75 + * For example, a two dimensional array of String returns 1.76 + * "<code>[][]</code>". 1.77 + */ 1.78 + String dimension(); 1.79 + 1.80 + /** 1.81 + * Return a string representation of the type. 1.82 + * This includes any dimension information and type arguments. 1.83 + * <p> 1.84 + * For example, a two dimensional array of String may return 1.85 + * "<code>java.lang.String[][]</code>", 1.86 + * and the parameterized type {@code List<Integer>} may return 1.87 + * "{@code java.util.List<java.lang.Integer>}". 1.88 + * 1.89 + * @return a string representation of the type. 1.90 + */ 1.91 + String toString(); 1.92 + 1.93 + /** 1.94 + * Return true if this type represents a primitive type. 1.95 + * 1.96 + * @return true if this type represents a primitive type. 1.97 + * @since 1.5 1.98 + */ 1.99 + boolean isPrimitive(); 1.100 + 1.101 + /** 1.102 + * Return this type as a <code>ClassDoc</code> if it represents a class 1.103 + * or interface. Array dimensions are ignored. 1.104 + * If this type is a <code>ParameterizedType</code>, 1.105 + * <code>TypeVariable</code>, or <code>WildcardType</code>, return 1.106 + * the <code>ClassDoc</code> of the type's erasure. If this is an 1.107 + * <code>AnnotationTypeDoc</code>, return this as a <code>ClassDoc</code> 1.108 + * (but see {@link #asAnnotationTypeDoc()}). 1.109 + * If this is a primitive type, return null. 1.110 + * 1.111 + * @return the <code>ClassDoc</code> of this type, 1.112 + * or null if it is a primitive type. 1.113 + */ 1.114 + ClassDoc asClassDoc(); 1.115 + 1.116 + /** 1.117 + * Return this type as a <code>ParameterizedType</code> if it represents 1.118 + * an invocation of a generic class or interface. Array dimensions 1.119 + * are ignored. 1.120 + * 1.121 + * @return a <code>ParameterizedType</code> if the type is an 1.122 + * invocation of a generic type, or null if it is not. 1.123 + * @since 1.5 1.124 + */ 1.125 + ParameterizedType asParameterizedType(); 1.126 + 1.127 + /** 1.128 + * Return this type as a <code>TypeVariable</code> if it represents 1.129 + * a type variable. Array dimensions are ignored. 1.130 + * 1.131 + * @return a <code>TypeVariable</code> if the type is a type variable, 1.132 + * or null if it is not. 1.133 + * @since 1.5 1.134 + */ 1.135 + TypeVariable asTypeVariable(); 1.136 + 1.137 + /** 1.138 + * Return this type as a <code>WildcardType</code> if it represents 1.139 + * a wildcard type. 1.140 + * 1.141 + * @return a <code>WildcardType</code> if the type is a wildcard type, 1.142 + * or null if it is not. 1.143 + * @since 1.5 1.144 + */ 1.145 + WildcardType asWildcardType(); 1.146 + 1.147 + /** 1.148 + * Return this type as an <code>AnnotationTypeDoc</code> if it represents 1.149 + * an annotation type. Array dimensions are ignored. 1.150 + * 1.151 + * @return an <code>AnnotationTypeDoc</code> if the type is an annotation 1.152 + * type, or null if it is not. 1.153 + * @since 1.5 1.154 + */ 1.155 + AnnotationTypeDoc asAnnotationTypeDoc(); 1.156 +}