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 a member type.
15 * The corresponding syntactic units are ClassDeclaration (JLS2 8.1) and InterfaceDeclaration (JLS2 9.1).
17 * Allowable child types for a type are <code>IDOMType</code>, <code>IDOMField</code>,
18 * <code>IDOMMethod</code>, and <code>IDOMInitializer</code>.
19 * Children are listed in the order in which they appear in the source. The parent of a type
20 * is a type (in the case of a member type) or a compilation unit (in the case of a top-level type).
23 * This interface is not intended to be implemented by clients.
26 public interface IDOMType extends IDOMMember {
28 * Adds the given interface name to the names of interfaces that this type implements or extends
29 * (the name will be added after the existing interface names). This is a convenience method.
31 * For classes, this represents the interfaces that this class implements.
32 * For interfaces, this represents the interfaces that this interface extends.
33 * The name may or may not be fully qualified.
35 * @param interfaceName the syntax for an interface name is defined by
36 * Interfaces in ClassDeclaration (JLS2 8.1). Type names must be specified as they would
37 * appear in source code. For example: "Cloneable", "java.io.Serializable".
39 * @exception IllegalArgumentException if <code>null</code> is specified
41 public void addSuperInterface(String interfaceName) throws IllegalArgumentException;
43 * The <code>IDOMType</code> refinement of this <code>IDOMNode</code>
44 * method returns the name of this type. The name of a class is defined by
45 * ClassDeclaration (JLS2 8.1); the name of an interface is defined by
46 * InterfaceDeclaration (JLS2 9.1).
48 public String getName();
50 * Returns the name of this type's superclass. The syntax for a superclass name
51 * is specified by Super in ClassDeclaration (JLS2 8.1). Type names must be
52 * specified as they would appear in source code. For example:
53 * <code>"Object"</code>, or <code>"java.io.File"</code>.
55 * @return the superclass name, or <code>null</code> if this type represents
56 * an interface or if no superclass has been assigned to this class
58 public String getSuperclass();
60 * Returns the names of interfaces that this type implements or extends,
61 * in the order in which they are listed in the source, or an empty array
62 * if no superinterfaces are present. The syntax for interface names is
63 * defined by Interfaces in ClassDeclaration (JLS2 8.1). Type names appear
64 * as they would in source code. For example: <code>"Cloneable"</code>,
65 * or <code>"java.io.Serializable"</code>.
67 * For classes, this method returns the interfaces that this class implements.
68 * For interfaces, this method returns the interfaces that this interface extends.
71 * @return the list of interface names
73 public String[] getSuperInterfaces();
75 * Returns whether this type is a class.
77 * @return <code>true</code> for classes, and <code>false</code> for interfaces
79 public boolean isClass();
81 * Sets whether this type is a class or an interface. If this type is
82 * a class, and is changed to an interface, this type's superclass
83 * becomes <code>null</code>. When a class becomes an interface or an
84 * interface becomes a class, superinterfaces remain (as part of an
85 * <code>implements</code> clause for classes, or an <code>extends</code>
86 * clause for interfaces).
88 * @param b <code>true</code> for classes, and <code>false</code> for interfaces
90 public void setClass(boolean b);
92 * The <code>IDOMType</code> refinement of this <code>IDOMNode</code>
93 * method sets the name of this type. The name of a class is defined by
94 * ClassDeclaration (JLS2 8.1); the name of an interface is defined by
95 * InterfaceDeclaration (JLS2 9.1).
97 * @exception IllegalArgumentException if <code>null</code> is specified
99 public void setName(String name) throws IllegalArgumentException;
101 * Sets the name of this type's superclass. Has no effect if this type
102 * represents an interface. A <code>null</code> name indicates that no
103 * superclass name (extends clause) should appear in the source code.
104 * The syntax for a superclass name is specified by Super in ClassDeclaration
105 * (JLS2 8.1). Type names must be specified as they would appear in source code.
106 * For example: <code>"Object"</code>, or <code>"java.io.File"</code>.
108 * @param superclassName the superclass name, or <code>null</code> if this type
109 * should have to no explicitly specified superclass
111 public void setSuperclass(String superclassName);
113 * Sets the names of interfaces that this type implements or extends,
114 * in the order in which they are to be listed in the source. An empty array
115 * parameter indicates that no superinterfaces are present. The syntax for
116 * interface names is defined by Interfaces in ClassDeclaration (JLS2 8.1).
117 * Type names appear as they would in source code. For example:
118 * <code>"Cloneable"</code>, or <code>"java.io.Serializable"</code>.
120 * For classes, this method sets the interfaces that this class implements.
121 * For interfaces, this method sets the interfaces that this interface extends.
124 * @param interfaceNames the list of interface names
126 public void setSuperInterfaces(String[] interfaceNames);