1 /* |
|
2 * Copyright (c) 2004, 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 */ |
|
25 |
|
26 package com.sun.mirror.type; |
|
27 |
|
28 |
|
29 import java.util.Collection; |
|
30 |
|
31 import com.sun.mirror.declaration.TypeDeclaration; |
|
32 |
|
33 |
|
34 /** |
|
35 * Represents a declared type, either a class type or an interface type. |
|
36 * This includes parameterized types such as {@code java.util.Set<String>} |
|
37 * as well as raw types. |
|
38 * |
|
39 * <p> While a <tt>TypeDeclaration</tt> represents the <i>declaration</i> |
|
40 * of a class or interface, a <tt>DeclaredType</tt> represents a class |
|
41 * or interface <i>type</i>, the latter being a use of the former. |
|
42 * See {@link TypeDeclaration} for more on this distinction. |
|
43 * |
|
44 * <p> A <tt>DeclaredType</tt> may represent a type |
|
45 * for which details (declaration, supertypes, <i>etc.</i>) are unknown. |
|
46 * This may be the result of a processing error, such as a missing class file, |
|
47 * and is indicated by {@link #getDeclaration()} returning <tt>null</tt>. |
|
48 * Other method invocations on such an unknown type will not, in general, |
|
49 * return meaningful results. |
|
50 * |
|
51 * @deprecated All components of this API have been superseded by the |
|
52 * standardized annotation processing API. The replacement for the |
|
53 * functionality of this interface is included in {@link |
|
54 * javax.lang.model.type.DeclaredType}. |
|
55 * |
|
56 * @author Joseph D. Darcy |
|
57 * @author Scott Seligman |
|
58 * @since 1.5 |
|
59 */ |
|
60 @Deprecated |
|
61 @SuppressWarnings("deprecation") |
|
62 public interface DeclaredType extends ReferenceType { |
|
63 |
|
64 /** |
|
65 * Returns the declaration of this type. |
|
66 * |
|
67 * <p> Returns null if this type's declaration is unknown. This may |
|
68 * be the result of a processing error, such as a missing class file. |
|
69 * |
|
70 * @return the declaration of this type, or null if unknown |
|
71 */ |
|
72 TypeDeclaration getDeclaration(); |
|
73 |
|
74 /** |
|
75 * Returns the type that contains this type as a member. |
|
76 * Returns <tt>null</tt> if this is a top-level type. |
|
77 * |
|
78 * <p> For example, the containing type of {@code O.I<S>} |
|
79 * is the type {@code O}, and the containing type of |
|
80 * {@code O<T>.I<S>} is the type {@code O<T>}. |
|
81 * |
|
82 * @return the type that contains this type, |
|
83 * or <tt>null</tt> if this is a top-level type |
|
84 */ |
|
85 DeclaredType getContainingType(); |
|
86 |
|
87 /** |
|
88 * Returns (in order) the actual type arguments of this type. |
|
89 * For a generic type nested within another generic type |
|
90 * (such as {@code Outer<String>.Inner<Number>}), only the type |
|
91 * arguments of the innermost type are included. |
|
92 * |
|
93 * @return the actual type arguments of this type, or an empty collection |
|
94 * if there are none |
|
95 */ |
|
96 Collection<TypeMirror> getActualTypeArguments(); |
|
97 |
|
98 /** |
|
99 * Returns the interface types that are direct supertypes of this type. |
|
100 * These are the interface types implemented or extended |
|
101 * by this type's declaration, with any type arguments |
|
102 * substituted in. |
|
103 * |
|
104 * <p> For example, the interface type extended by |
|
105 * {@code java.util.Set<String>} is {@code java.util.Collection<String>}. |
|
106 * |
|
107 * @return the interface types that are direct supertypes of this type, |
|
108 * or an empty collection if there are none |
|
109 */ |
|
110 Collection<InterfaceType> getSuperinterfaces(); |
|
111 } |
|