org.eclipse.emf.codegen.merge.java.facade
Interface JType

All Superinterfaces:
JAbstractType, JMember, JNode
All Known Implementing Classes:
ASTJType, JDOMJType

public interface JType
extends JAbstractType

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). Enumeration types and annotation types, added in J2SE 1.5, are represented as classes and interfaces, respectively.

Since:
2.2.0

Method Summary
 void addSuperInterface(java.lang.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).
 java.lang.String getSuperclass()
          Returns the name of this type's superclass.
 java.lang.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 super interfaces are present.
 java.lang.String[] getTypeParameters()
          Returns the formal type parameters for this type.
 void setSuperclass(java.lang.String superclassName)
          Sets the name of this type's superclass.
 void setSuperInterfaces(java.lang.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.
 void setTypeParameters(java.lang.String[] typeParameters)
          Sets the formal type parameters for this type.
 
Methods inherited from interface org.eclipse.emf.codegen.merge.java.facade.JMember
getComment, setComment
 
Methods inherited from interface org.eclipse.emf.codegen.merge.java.facade.JNode
getChildren, getContents, getFlags, getName, getParent, getQualifiedName, setFlags, setName
 

Method Detail

getSuperclass

java.lang.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". As of J2SE 1.5, the superclass may also include parameterized types like "ArrayList<String>".

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

setSuperclass

void setSuperclass(java.lang.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". As of J2SE 1.5, the superclass may also include parameterized types like "ArrayList<String>".

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

getSuperInterfaces

java.lang.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 super interfaces 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". As of J2SE 1.5, super interfaces may also include parameterized types like "List<String>".

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, or an empty array if no interfaces are declared

setSuperInterfaces

void setSuperInterfaces(java.lang.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 super interfaces 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". As of J2SE 1.5, super interfaces may also include parameterized types like "List<String>".

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

addSuperInterface

void addSuperInterface(java.lang.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). 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".

getTypeParameters

java.lang.String[] getTypeParameters()
Returns the formal type parameters for this type. Returns an empty array if this method has no formal type parameters.

Formal type parameters are as they appear in the source code; for example: "X extends List<String> & Serializable".

Returns:
the formal type parameters of this type, in the order declared in the source, or an empty array if no type parameters are declared

setTypeParameters

void setTypeParameters(java.lang.String[] typeParameters)
Sets the formal type parameters for this type.

Formal type parameters are given as they appear in the source code; for example: "X extends List<String> & Serializable".

Parameters:
typeParameters - the formal type parameters of this type, in the order to appear in the source, an empty array if none
Since:
2.3.0

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.