KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > type > DeclaredType


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

7
8 package javax.lang.model.type;
9
10
11 import java.util.List JavaDoc;
12
13 import javax.lang.model.element.Element;
14 import javax.lang.model.element.TypeElement;
15 import javax.lang.model.util.Types;
16
17
18 /**
19  * Represents a declared type, either a class type or an interface type.
20  * This includes parameterized types such as {@code java.util.Set<String>}
21  * as well as raw types.
22  *
23  * <p> While a {@code TypeElement} represents a class or interface
24  * <i>element</i>, a {@code DeclaredType} represents a class
25  * or interface <i>type</i>, the latter being a use
26  * (or <i>invocation</i>) of the former.
27  * See {@link TypeElement} for more on this distinction.
28  *
29  * <p> The supertypes (both class and interface types) of a declared
30  * type may be found using the {@link
31  * Types#directSupertypes(TypeMirror)} method. This returns the
32  * supertypes with any type arguments substituted in.
33  *
34  * <p> This interface is also used to represent intersection types.
35  * An intersection type is implicit in a program rather than being
36  * explictly declared. For example, the bound of the type parameter
37  * {@code <T extends Number & Runnable>}
38  * is an intersection type. It is represented by a {@code DeclaredType}
39  * with {@code Number} as its superclass and {@code Runnable} as its
40  * lone superinterface.
41  *
42  * @author Joseph D. Darcy
43  * @author Scott Seligman
44  * @author Peter von der Ah&eacute;
45  * @version 1.6 06/08/07
46  * @see TypeElement
47  * @since 1.6
48  */

49 public interface DeclaredType extends ReferenceType {
50
51     /**
52      * Returns the element corresponding to this type.
53      *
54      * @return the element corresponding to this type
55      */

56     Element asElement();
57
58     /**
59      * Returns the type of the innermost enclosing instance or a
60      * {@code NoType} of kind {@code NONE} if there is no enclosing
61      * instance. Only types corresponding to inner classes have an
62      * enclosing instance.
63      *
64      * @return a type mirror for the enclosing type
65      * @jls3 8.1.3 Inner Classes and Enclosing Instances
66      * @jls3 15.9.2 Determining Enclosing Instances
67      */

68     TypeMirror getEnclosingType();
69
70     /**
71      * Returns the actual type arguments of this type.
72      * For a type nested within a parameterized type
73      * (such as {@code Outer<String>.Inner<Number>}), only the type
74      * arguments of the innermost type are included.
75      *
76      * @return the actual type arguments of this type, or an empty list
77      * if none
78      */

79     List JavaDoc<? extends TypeMirror> getTypeArguments();
80 }
81
Popular Tags