KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > mirror > type > DeclaredType


1 /*
2  * @(#)DeclaredType.java 1.6 04/06/07
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.mirror.type;
9
10
11 import java.util.Collection JavaDoc;
12
13 import com.sun.mirror.declaration.TypeDeclaration;
14
15
16 /**
17  * Represents a declared type, either a class type or an interface type.
18  * This includes parameterized types such as {@code java.util.Set<String>}
19  * as well as raw types.
20  *
21  * <p> While a <tt>TypeDeclaration</tt> represents the <i>declaration</i>
22  * of a class or interface, a <tt>DeclaredType</tt> represents a class
23  * or interface <i>type</i>, the latter being a use of the former.
24  * See {@link TypeDeclaration} for more on this distinction.
25  *
26  * <p> A <tt>DeclaredType</tt> may represent a type
27  * for which details (declaration, supertypes, <i>etc.</i>) are unknown.
28  * This may be the result of a processing error, such as a missing class file,
29  * and is indicated by {@link #getDeclaration()} returning <tt>null</tt>.
30  * Other method invocations on such an unknown type will not, in general,
31  * return meaningful results.
32  *
33  * @author Joseph D. Darcy
34  * @author Scott Seligman
35  * @version 1.6 04/06/07
36  * @since 1.5
37  */

38
39 public interface DeclaredType extends ReferenceType {
40
41     /**
42      * Returns the declaration of this type.
43      *
44      * <p> Returns null if this type's declaration is unknown. This may
45      * be the result of a processing error, such as a missing class file.
46      *
47      * @return the declaration of this type, or null if unknown
48      */

49     TypeDeclaration getDeclaration();
50
51     /**
52      * Returns the type that contains this type as a member.
53      * Returns <tt>null</tt> if this is a top-level type.
54      *
55      * <p> For example, the containing type of {@code O.I<S>}
56      * is the type {@code O}, and the containing type of
57      * {@code O<T>.I<S>} is the type {@code O<T>}.
58      *
59      * @return the type that contains this type,
60      * or <tt>null</tt> if this is a top-level type
61      */

62     DeclaredType getContainingType();
63
64     /**
65      * Returns (in order) the actual type arguments of this type.
66      * For a generic type nested within another generic type
67      * (such as {@code Outer<String>.Inner<Number>}), only the type
68      * arguments of the innermost type are included.
69      *
70      * @return the actual type arguments of this type, or an empty collection
71      * if there are none
72      */

73     Collection JavaDoc<TypeMirror> getActualTypeArguments();
74
75     /**
76      * Returns the interface types that are direct supertypes of this type.
77      * These are the interface types implemented or extended
78      * by this type's declaration, with any type arguments
79      * substituted in.
80      *
81      * <p> For example, the interface type extended by
82      * {@code java.util.Set<String>} is {@code java.util.Collection<String>}.
83      *
84      * @return the interface types that are direct supertypes of this type,
85      * or an empty collection if there are none
86      */

87     Collection JavaDoc<InterfaceType> getSuperinterfaces();
88 }
89
Popular Tags