10
|
1 |
/*
|
5520
|
2 |
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
|
10
|
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
|
5520
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
10
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5520
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
10
|
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 |
*
|
5520
|
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.
|
10
|
24 |
*/
|
|
25 |
|
|
26 |
package com.sun.javadoc;
|
|
27 |
|
|
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 {
|
|
40 |
|
|
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();
|
|
48 |
|
|
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();
|
|
56 |
|
|
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();
|
|
68 |
|
|
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();
|
|
76 |
|
|
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();
|
|
89 |
|
|
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();
|
|
97 |
|
|
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();
|
|
112 |
|
|
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();
|
|
123 |
|
|
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();
|
|
133 |
|
|
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();
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Return this type as an <code>AnnotationTypeDoc</code> if it represents
|
|
146 |
* an annotation type. Array dimensions are ignored.
|
|
147 |
*
|
|
148 |
* @return an <code>AnnotationTypeDoc</code> if the type is an annotation
|
|
149 |
* type, or null if it is not.
|
|
150 |
* @since 1.5
|
|
151 |
*/
|
|
152 |
AnnotationTypeDoc asAnnotationTypeDoc();
|
|
153 |
}
|