1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.core.jdom;
14 * Represents a source type in a compilation unit, either as a top-level type or
15 * a member type. The corresponding syntactic units are ClassDeclaration (JLS2
16 * 8.1) and InterfaceDeclaration (JLS2 9.1).
18 * Allowable child types for a type are <code>IDOMType</code>,
19 * <code>IDOMField</code>, <code>IDOMMethod</code>, and
20 * <code>IDOMInitializer</code>. Children are listed in the order in which
21 * they appear in the source. The parent of a type is a type (in the case of a
22 * member type) or a compilation unit (in the case of a top-level type).
25 * This interface is not intended to be implemented by clients.
28 public interface IDOMType extends IDOMMember {
30 * Adds the given interface name to the names of interfaces that this type
31 * implements or extends (the name will be added after the existing
32 * interface names). This is a convenience method.
34 * For classes, this represents the interfaces that this class implements.
35 * For interfaces, this represents the interfaces that this interface
36 * extends. The name may or may not be fully qualified.
38 * @param interfaceName
39 * the syntax for an interface name is defined by Interfaces in
40 * ClassDeclaration (JLS2 8.1). Type names must be specified as
41 * they would appear in source code. For example: "Cloneable",
42 * "java.io.Serializable".
44 * @exception IllegalArgumentException
45 * if <code>null</code> is specified
47 public void addSuperInterface(String interfaceName)
48 throws IllegalArgumentException;
51 * The <code>IDOMType</code> refinement of this <code>IDOMNode</code>
52 * method returns the name of this type. The name of a class is defined by
53 * ClassDeclaration (JLS2 8.1); the name of an interface is defined by
54 * InterfaceDeclaration (JLS2 9.1).
56 public String getName();
59 * Returns the name of this type's superclass. The syntax for a superclass
60 * name is specified by Super in ClassDeclaration (JLS2 8.1). Type names
61 * must be specified as they would appear in source code. For example:
62 * <code>"Object"</code>, or <code>"java.io.File"</code>.
64 * @return the superclass name, or <code>null</code> if this type
65 * represents an interface or if no superclass has been assigned to
68 public String getSuperclass();
71 * Returns the names of interfaces that this type implements or extends, in
72 * the order in which they are listed in the source, or an empty array if no
73 * superinterfaces are present. The syntax for interface names is defined by
74 * Interfaces in ClassDeclaration (JLS2 8.1). Type names appear as they
75 * would in source code. For example: <code>"Cloneable"</code>, or
76 * <code>"java.io.Serializable"</code>.
78 * For classes, this method returns the interfaces that this class
79 * implements. For interfaces, this method returns the interfaces that this
83 * @return the list of interface names
85 public String[] getSuperInterfaces();
88 * Returns whether this type is a class.
90 * @return <code>true</code> for classes, and <code>false</code> for
93 public boolean isClass();
96 * Sets whether this type is a class or an interface. If this type is a
97 * class, and is changed to an interface, this type's superclass becomes
98 * <code>null</code>. When a class becomes an interface or an interface
99 * becomes a class, superinterfaces remain (as part of an
100 * <code>implements</code> clause for classes, or an <code>extends</code>
101 * clause for interfaces).
104 * <code>true</code> for classes, and <code>false</code> for
107 public void setClass(boolean b);
110 * The <code>IDOMType</code> refinement of this <code>IDOMNode</code>
111 * method sets the name of this type. The name of a class is defined by
112 * ClassDeclaration (JLS2 8.1); the name of an interface is defined by
113 * InterfaceDeclaration (JLS2 9.1).
115 * @exception IllegalArgumentException
116 * if <code>null</code> is specified
118 public void setName(String name) throws IllegalArgumentException;
121 * Sets the name of this type's superclass. Has no effect if this type
122 * represents an interface. A <code>null</code> name indicates that no
123 * superclass name (extends clause) should appear in the source code. The
124 * syntax for a superclass name is specified by Super in ClassDeclaration
125 * (JLS2 8.1). Type names must be specified as they would appear in source
126 * code. For example: <code>"Object"</code>, or
127 * <code>"java.io.File"</code>.
129 * @param superclassName
130 * the superclass name, or <code>null</code> if this type
131 * should have to no explicitly specified superclass
133 public void setSuperclass(String superclassName);
136 * Sets the names of interfaces that this type implements or extends, in the
137 * order in which they are to be listed in the source. An empty array
138 * parameter indicates that no superinterfaces are present. The syntax for
139 * interface names is defined by Interfaces in ClassDeclaration (JLS2 8.1).
140 * Type names appear as they would in source code. For example:
141 * <code>"Cloneable"</code>, or <code>"java.io.Serializable"</code>.
143 * For classes, this method sets the interfaces that this class implements.
144 * For interfaces, this method sets the interfaces that this interface
148 * @param interfaceNames
149 * the list of interface names
151 public void setSuperInterfaces(String[] interfaceNames);