KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > mirror > declaration > TypeDeclaration


1 /*
2  * @(#)TypeDeclaration.java 1.4 04/04/30
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.declaration;
9
10
11 import java.util.Collection JavaDoc;
12
13 import com.sun.mirror.type.*;
14
15
16 /**
17  * Represents the declaration of a class or interface.
18  * Provides access to information about the type and its members.
19  * Note that an {@linkplain EnumDeclaration enum} is a kind of class,
20  * and an {@linkplain AnnotationTypeDeclaration annotation type} is
21  * a kind of interface.
22  *
23  * <p> <a name="DECL_VS_TYPE"></a>
24  * While a <tt>TypeDeclaration</tt> represents the <i>declaration</i>
25  * of a class or interface, a {@link DeclaredType} represents a class
26  * or interface <i>type</i>, the latter being a use
27  * (or <i>invocation</i>) of the former.
28  * The distinction is most apparent with generic types,
29  * for which a single declaration can define a whole
30  * family of types. For example, the declaration of
31  * {@code java.util.Set} corresponds to the parameterized types
32  * {@code java.util.Set<String>} and {@code java.util.Set<Number>}
33  * (and many others), and to the raw type {@code java.util.Set}.
34  *
35  * <p> {@link com.sun.mirror.util.DeclarationFilter}
36  * provides a simple way to select just the items of interest
37  * when a method returns a collection of declarations.
38  *
39  * @author Joseph D. Darcy
40  * @author Scott Seligman
41  * @version 1.4 04/04/30
42  *
43  * @see DeclaredType
44  * @since 1.5
45  */

46
47 public interface TypeDeclaration extends MemberDeclaration {
48
49     /**
50      * Returns the package within which this type is declared.
51      *
52      * @return the package within which this type is declared
53      */

54     PackageDeclaration getPackage();
55
56     /**
57      * Returns the fully qualified name of this class or interface
58      * declaration. More precisely, it returns the <i>canonical</i>
59      * name.
60      * The name of a generic type does not include any reference
61      * to its formal type parameters.
62      * For example, the the fully qualified name of the interface declaration
63      * {@code java.util.Set<E>} is <tt>"java.util.Set"</tt>.
64      *
65      * @return the fully qualified name of this class or interface declaration
66      */

67     String JavaDoc getQualifiedName();
68
69     /**
70      * Returns the formal type parameters of this class or interface.
71      *
72      * @return the formal type parameters, or an empty collection
73      * if there are none
74      */

75     Collection JavaDoc<TypeParameterDeclaration> getFormalTypeParameters();
76
77     /**
78      * Returns the interface types directly implemented by this class
79      * or extended by this interface.
80      *
81      * @return the interface types directly implemented by this class
82      * or extended by this interface, or an empty collection if there are none
83      *
84      * @see com.sun.mirror.util.DeclarationFilter
85      */

86     Collection JavaDoc<InterfaceType> getSuperinterfaces();
87
88     /**
89      * Returns the fields that are directly declared by this class or
90      * interface. Includes enum constants.
91      *
92      * @return the fields that are directly declared,
93      * or an empty collection if there are none
94      *
95      * @see com.sun.mirror.util.DeclarationFilter
96      */

97     Collection JavaDoc<FieldDeclaration> getFields();
98
99     /**
100      * Returns the methods that are directly declared by this class or
101      * interface. Includes annotation type elements. Excludes
102      * implicitly declared methods of an interface, such as
103      * <tt>toString</tt>, that correspond to the methods of
104      * <tt>java.lang.Object</tt>.
105      *
106      * @return the methods that are directly declared,
107      * or an empty collection if there are none
108      *
109      * @see com.sun.mirror.util.DeclarationFilter
110      */

111     Collection JavaDoc<? extends MethodDeclaration> getMethods();
112
113     /**
114      * Returns the declarations of the nested classes and interfaces
115      * that are directly declared by this class or interface.
116      *
117      * @return the declarations of the nested classes and interfaces,
118      * or an empty collection if there are none
119      *
120      * @see com.sun.mirror.util.DeclarationFilter
121      */

122     Collection JavaDoc<TypeDeclaration> getNestedTypes();
123 }
124
Popular Tags