Eclipse JDT
2.0

org.eclipse.jdt.core.jdom
Interface IDOMType

All Superinterfaces:
Cloneable, IDOMMember, IDOMNode

public interface IDOMType
extends IDOMMember

Represents a source type in a compilation unit, either as a top-level type or a member type. The corresponding syntactic units are ClassDeclaration (JLS2 8.1) and InterfaceDeclaration (JLS2 9.1).

Allowable child types for a type are IDOMType, IDOMField, IDOMMethod, and IDOMInitializer. Children are listed in the order in which they appear in the source. The parent of a type is a type (in the case of a member type) or a compilation unit (in the case of a top-level type).

This interface is not intended to be implemented by clients.


Field Summary
 
Fields inherited from interface org.eclipse.jdt.core.jdom.IDOMNode
COMPILATION_UNIT, FIELD, IMPORT, INITIALIZER, METHOD, PACKAGE, TYPE
 
Method Summary
 void addSuperInterface(String interfaceName)
          Adds the given interface name to the names of interfaces that this type implements or extends (the name will be added after the existing interface names).
 String getName()
          The IDOMType refinement of this IDOMNode method returns the name of this type.
 String getSuperclass()
          Returns the name of this type's superclass.
 String[] getSuperInterfaces()
          Returns the names of interfaces that this type implements or extends, in the order in which they are listed in the source, or an empty array if no superinterfaces are present.
 boolean isClass()
          Returns whether this type is a class.
 void setClass(boolean b)
          Sets whether this type is a class or an interface.
 void setName(String name)
          The IDOMType refinement of this IDOMNode method sets the name of this type.
 void setSuperclass(String superclassName)
          Sets the name of this type's superclass.
 void setSuperInterfaces(String[] interfaceNames)
          Sets the names of interfaces that this type implements or extends, in the order in which they are to be listed in the source.
 
Methods inherited from interface org.eclipse.jdt.core.jdom.IDOMMember
getComment, getFlags, setComment, setFlags
 
Methods inherited from interface org.eclipse.jdt.core.jdom.IDOMNode
addChild, canHaveChildren, clone, getCharacters, getChild, getChildren, getContents, getFirstChild, getJavaElement, getNextNode, getNodeType, getParent, getPreviousNode, insertSibling, isAllowableChild, isSignatureEqual, remove
 

Method Detail

addSuperInterface

public void addSuperInterface(String interfaceName)
                       throws IllegalArgumentException
Adds the given interface name to the names of interfaces that this type implements or extends (the name will be added after the existing interface names). This is a convenience method. For classes, this represents the interfaces that this class implements. For interfaces, this represents the interfaces that this interface extends. The name may or may not be fully qualified.

Parameters:
interfaceName - the syntax for an interface name is defined by Interfaces in ClassDeclaration (JLS2 8.1). Type names must be specified as they would appear in source code. For example: "Cloneable", "java.io.Serializable".
Throws:
IllegalArgumentException - if null is specified

getName

public String getName()
The IDOMType refinement of this IDOMNode method returns the name of this type. The name of a class is defined by ClassDeclaration (JLS2 8.1); the name of an interface is defined by InterfaceDeclaration (JLS2 9.1).

Specified by:
getName in interface IDOMNode
Returns:
the name, or null if it has no name

getSuperclass

public String getSuperclass()
Returns the name of this type's superclass. The syntax for a superclass name is specified by Super in ClassDeclaration (JLS2 8.1). Type names must be specified as they would appear in source code. For example: "Object", or "java.io.File".

Returns:
the superclass name, or null if this type represents an interface or if no superclass has been assigned to this class

getSuperInterfaces

public String[] getSuperInterfaces()
Returns the names of interfaces that this type implements or extends, in the order in which they are listed in the source, or an empty array if no superinterfaces are present. The syntax for interface names is defined by Interfaces in ClassDeclaration (JLS2 8.1). Type names appear as they would in source code. For example: "Cloneable", or "java.io.Serializable".

For classes, this method returns the interfaces that this class implements. For interfaces, this method returns the interfaces that this interface extends.

Returns:
the list of interface names

isClass

public boolean isClass()
Returns whether this type is a class.

Returns:
true for classes, and false for interfaces

setClass

public void setClass(boolean b)
Sets whether this type is a class or an interface. If this type is a class, and is changed to an interface, this type's superclass becomes null. When a class becomes an interface or an interface becomes a class, superinterfaces remain (as part of an implements clause for classes, or an extends clause for interfaces).

Parameters:
b - true for classes, and false for interfaces

setName

public void setName(String name)
             throws IllegalArgumentException
The IDOMType refinement of this IDOMNode method sets the name of this type. The name of a class is defined by ClassDeclaration (JLS2 8.1); the name of an interface is defined by InterfaceDeclaration (JLS2 9.1).

Specified by:
setName in interface IDOMNode
Parameters:
name - the name, or null to clear the name
Throws:
IllegalArgumentException - if null is specified

setSuperclass

public void setSuperclass(String superclassName)
Sets the name of this type's superclass. Has no effect if this type represents an interface. A null name indicates that no superclass name (extends clause) should appear in the source code. The syntax for a superclass name is specified by Super in ClassDeclaration (JLS2 8.1). Type names must be specified as they would appear in source code. For example: "Object", or "java.io.File".

Parameters:
superclassName - the superclass name, or null if this type should have to no explicitly specified superclass

setSuperInterfaces

public void setSuperInterfaces(String[] interfaceNames)
Sets the names of interfaces that this type implements or extends, in the order in which they are to be listed in the source. An empty array parameter indicates that no superinterfaces are present. The syntax for interface names is defined by Interfaces in ClassDeclaration (JLS2 8.1). Type names appear as they would in source code. For example: "Cloneable", or "java.io.Serializable".

For classes, this method sets the interfaces that this class implements. For interfaces, this method sets the interfaces that this interface extends.

Parameters:
interfaceNames - the list of interface names

Eclipse JDT
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.