KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > element > TypeElement


1 /*
2  * @(#)TypeElement.java 1.8 06/08/15
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.element;
9
10 import java.util.List JavaDoc;
11 import javax.lang.model.type.*;
12 import javax.lang.model.util.*;
13
14 /**
15  * Represents a class or interface program element. Provides access
16  * to information about the type and its members. Note that an enum
17  * type is a kind of class and an annotation type is a kind of
18  * interface.
19  *
20  * <p> <a name="ELEM_VS_TYPE"></a>
21  * While a {@code TypeElement} represents a class or interface
22  * <i>element</i>, a {@link DeclaredType} represents a class
23  * or interface <i>type</i>, the latter being a use
24  * (or <i>invocation</i>) of the former.
25  * The distinction is most apparent with generic types,
26  * for which a single element can define a whole
27  * family of types. For example, the element
28  * {@code java.util.Set} corresponds to the parameterized types
29  * {@code java.util.Set<String>} and {@code java.util.Set<Number>}
30  * (and many others), and to the raw type {@code java.util.Set}.
31  *
32  * <p> Each method of this interface that returns a list of elements
33  * will return them in the order that is natural for the underlying
34  * source of program information. For example, if the underlying
35  * source of information is Java source code, then the elements will be
36  * returned in source code order.
37  *
38  * @author Joseph D. Darcy
39  * @author Scott Seligman
40  * @author Peter von der Ah&eacute;
41  * @version 1.8 06/08/15
42  * @see DeclaredType
43  * @since 1.6
44  */

45 public interface TypeElement extends Element {
46
47     /**
48      * Returns the <i>nesting kind</i> of this type element.
49      *
50      * @return the nesting kind of this type element
51      */

52     NestingKind getNestingKind();
53
54     /**
55      * Returns the fully qualified name of this type element.
56      * More precisely, it returns the <i>canonical</i> name.
57      * For local and anonymous classes, which do not have canonical names,
58      * an empty name is returned.
59      *
60      * <p>The name of a generic type does not include any reference
61      * to its formal type parameters.
62      * For example, the fully qualified name of the interface
63      * {@code java.util.Set<E>} is "{@code java.util.Set}".
64      * Nested types use "{@code .}" as a separator, as in
65      * "{@code java.util.Map.Entry}".
66      *
67      * @return the fully qualified name of this class or interface, or
68      * an empty name if none
69      *
70      * @see Elements#getBinaryName
71      * @jls3 6.7 Fully Qualified Names and Canonical Names
72      */

73     Name getQualifiedName();
74
75     /**
76      * Returns the direct superclass of this type element.
77      * If this type element represents an interface or the class
78      * {@code java.lang.Object}, then a {@link NoType}
79      * with kind {@link TypeKind#NONE NONE} is returned.
80      *
81      * @return the direct superclass, or a {@code NoType} if there is none
82      */

83     TypeMirror getSuperclass();
84
85     /**
86      * Returns the interface types directly implemented by this class
87      * or extended by this interface.
88      *
89      * @return the interface types directly implemented by this class
90      * or extended by this interface, or an empty list if there are none
91      */

92     List JavaDoc<? extends TypeMirror> getInterfaces();
93
94     /**
95      * Returns the formal type parameters of this type element
96      * in declaration order.
97      *
98      * @return the formal type parameters, or an empty list
99      * if there are none
100      */

101     List JavaDoc<? extends TypeParameterElement> getTypeParameters();
102 }
103
Popular Tags