KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > jdom > IDOMType


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.core.jdom;
12
13 /**
14  * Represents a source type in a compilation unit, either as a top-level type or a member type.
15  * The corresponding syntactic units are ClassDeclaration (JLS2 8.1) and InterfaceDeclaration (JLS2 9.1).
16  * Enumeration types and annotation types, added in J2SE 1.5, are represented as
17  * classes and interfaces, respectively.
18  * <p>
19  * Allowable child types for a type are <code>IDOMType</code>, <code>IDOMField</code>,
20  * <code>IDOMMethod</code>, and <code>IDOMInitializer</code>.
21  * Children are listed in the order in which they appear in the source. The parent of a type
22  * is a type (in the case of a member type) or a compilation unit (in the case of a top-level type).
23  * </p>
24  * <p>
25  * This interface is not intended to be implemented by clients.
26  * </p>
27  * @deprecated The JDOM was made obsolete by the addition in 2.0 of the more
28  * powerful, fine-grained DOM/AST API found in the
29  * org.eclipse.jdt.core.dom package.
30  */

31 public interface IDOMType extends IDOMMember {
32 /**
33  * Adds the given interface name to the names of interfaces that this type implements or extends
34  * (the name will be added after the existing interface names). This is a convenience method.
35  *
36  * For classes, this represents the interfaces that this class implements.
37  * For interfaces, this represents the interfaces that this interface extends.
38  * The name may or may not be fully qualified.
39  *
40  * @param interfaceName the syntax for an interface name is defined by
41  * Interfaces in ClassDeclaration (JLS2 8.1). Type names must be specified as they would
42  * appear in source code. For example: "Cloneable", "java.io.Serializable".
43  *
44  * @exception IllegalArgumentException if <code>null</code> is specified
45  */

46 public void addSuperInterface(String JavaDoc interfaceName) throws IllegalArgumentException JavaDoc;
47
48 /**
49  * Returns the formal type parameters for this type.
50  * Returns an empty array if this method has no formal type parameters.
51  * <p>Formal type parameters are as they appear in the source
52  * code; for example:
53  * <code>"X extends List&lt;String&gt; & Serializable"</code>.
54  * </p>
55  *
56  * @return the formal type parameters of this type,
57  * in the order declared in the source, an empty array if none
58  * @since 3.0
59  */

60 String JavaDoc[] getTypeParameters();
61
62 /**
63  * The <code>IDOMType</code> refinement of this <code>IDOMNode</code>
64  * method returns the name of this type. The name of a class is defined by
65  * ClassDeclaration (JLS2 8.1); the name of an interface is defined by
66  * InterfaceDeclaration (JLS2 9.1).
67  *
68  * @return the name of this type
69  */

70 public String JavaDoc getName();
71 /**
72  * Returns the name of this type's superclass. The syntax for a superclass name
73  * is specified by Super in ClassDeclaration (JLS2 8.1). Type names must be
74  * specified as they would appear in source code. For example:
75  * <code>"Object"</code>, or <code>"java.io.File"</code>.
76  * As of J2SE 1.5, the superclass may also include parameterized
77  * types like <code>"ArrayList&lt;String&gt;"</code>.
78  *
79  * @return the superclass name, or <code>null</code> if this type represents
80  * an interface or if no superclass has been assigned to this class
81  */

82 public String JavaDoc getSuperclass();
83 /**
84  * Returns the names of interfaces that this type implements or extends,
85  * in the order in which they are listed in the source, or an empty array
86  * if no superinterfaces are present. The syntax for interface names is
87  * defined by Interfaces in ClassDeclaration (JLS2 8.1). Type names appear
88  * as they would in source code. For example: <code>"Cloneable"</code>,
89  * or <code>"java.io.Serializable"</code>.
90  * As of J2SE 1.5, superinterfaces may also include parameterized
91  * types like <code>"List&lt;String&gt;"</code>.
92  * <p>
93  * For classes, this method returns the interfaces that this class implements.
94  * For interfaces, this method returns the interfaces that this interface extends.
95  * </p>
96  *
97  * @return the list of interface names
98  */

99 public String JavaDoc[] getSuperInterfaces();
100 /**
101  * Returns whether this type is a class.
102  *
103  * @return <code>true</code> for classes, and <code>false</code> for interfaces
104  */

105 public boolean isClass();
106
107 /**
108  * Returns whether this type represents an enumeration class ("enum" instead of "class").
109  *
110  * @return true if this type represents an enumeration class, false otherwise
111  * @since 3.0
112  */

113 boolean isEnum();
114
115 /**
116  * Returns whether this type represents an annotation type ("@interface" instead of "interface").
117  *
118  * @return true if this type represents an annotation type, false otherwise
119  * @since 3.0
120  */

121 boolean isAnnotation();
122
123 /**
124  * Sets whether this type is a class or an interface. If this type is
125  * a class, and is changed to an interface, this type's superclass
126  * becomes <code>null</code>. When a class becomes an interface or an
127  * interface becomes a class, superinterfaces remain (as part of an
128  * <code>implements</code> clause for classes, or an <code>extends</code>
129  * clause for interfaces).
130  *
131  * @param b <code>true</code> for classes, and <code>false</code> for interfaces
132  */

133 public void setClass(boolean b);
134
135 /**
136  * Sets whether this type represents an enumeration class.
137  * If this type is a class and is changed to an enum,
138  * this type's superclass becomes <code>null</code>.
139  * If this type is an interface (including an annotation type),
140  * and is changed to an enum, this type is also changed to a class.
141  *
142  * @param b <code>true</code> for enum classes, and <code>false</code> otherwise
143  * @since 3.0
144  */

145 public void setEnum(boolean b);
146
147 /**
148  * Sets whether this type represents an annotation type ("@interface" instead of "interface").
149  * If this type is a interface and is changed to an enum,
150  * this type's superclass becomes <code>null</code> and its superinterface list
151  * becomes empty. If this type is an class (including an enum),
152  * and is changed to an annotation type, this type is also changed to an interface.
153  *
154  * @param b <code>true</code> for an annotation type, and <code>false</code> otherwise
155  * @since 3.0
156  */

157 public void setAnnotation(boolean b);
158
159 /**
160  * Sets the formal type parameters for this type.
161  * <p>Formal type parameters are given as they appear in the source
162  * code; for example:
163  * <code>"X extends List&lt;String&gt; & Serializable"</code>.
164  * </p>
165  *
166  * @param typeParameters the formal type parameters of this type,
167  * in the order to appear in the source, an empty array if none
168  * @since 3.0
169  */

170 void setTypeParameters(String JavaDoc[] typeParameters);
171
172 /**
173  * The <code>IDOMType</code> refinement of this <code>IDOMNode</code>
174  * method sets the name of this type. The name of a class is defined by
175  * ClassDeclaration (JLS2 8.1); the name of an interface is defined by
176  * InterfaceDeclaration (JLS2 9.1).
177  *
178  * @param name the given name
179  * @exception IllegalArgumentException if <code>null</code> is specified
180  */

181 public void setName(String JavaDoc name) throws IllegalArgumentException JavaDoc;
182 /**
183  * Sets the name of this type's superclass. Has no effect if this type
184  * represents an interface. A <code>null</code> name indicates that no
185  * superclass name (extends clause) should appear in the source code.
186  * The syntax for a superclass name is specified by Super in ClassDeclaration
187  * (JLS2 8.1). Type names must be specified as they would appear in source code.
188  * For example: <code>"Object"</code>, or <code>"java.io.File"</code>.
189  * As of J2SE 1.5, the superclass may also include parameterized
190  * types like <code>"ArrayList&lt;String&gt;"</code>.
191  *
192  * @param superclassName the superclass name, or <code>null</code> if this type
193  * should have to no explicitly specified superclass
194  */

195 public void setSuperclass(String JavaDoc superclassName);
196 /**
197  * Sets the names of interfaces that this type implements or extends,
198  * in the order in which they are to be listed in the source. An empty array
199  * parameter indicates that no superinterfaces are present. The syntax for
200  * interface names is defined by Interfaces in ClassDeclaration (JLS2 8.1).
201  * Type names appear as they would in source code. For example:
202  * <code>"Cloneable"</code>, or <code>"java.io.Serializable"</code>.
203  * As of J2SE 1.5, superinterfaces may also include parameterized
204  * types like <code>"List&lt;String&gt;"</code>.
205  * <p>
206  * For classes, this method sets the interfaces that this class implements.
207  * For interfaces, this method sets the interfaces that this interface extends.
208  * </p>
209  *
210  * @param interfaceNames the list of interface names
211  */

212 public void setSuperInterfaces(String JavaDoc[] interfaceNames);
213 }
214
Popular Tags