org.eclipse.emf.codegen.merge.java.facade.ast
Class ASTJType

java.lang.Object
  extended byorg.eclipse.emf.codegen.merge.java.facade.AbstractJNode
      extended byorg.eclipse.emf.codegen.merge.java.facade.ast.ASTJNode
          extended byorg.eclipse.emf.codegen.merge.java.facade.ast.ASTJMember
              extended byorg.eclipse.emf.codegen.merge.java.facade.ast.ASTJType
All Implemented Interfaces:
JMember, JNode, JType

public class ASTJType
extends ASTJMember
implements JType

Since:
2.2.0

Field Summary
 
Fields inherited from class org.eclipse.emf.codegen.merge.java.facade.AbstractJNode
EMPTY_STRING_ARRAY, facadeHelper, qualifiedName, wrappedObject
 
Constructor Summary
ASTJType(org.eclipse.jdt.core.dom.TypeDeclaration typeDeclaration)
           
 
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).
protected  String computeQualifiedName()
           
protected  org.eclipse.jdt.core.dom.TypeDeclaration getASTTypeDeclaration()
           
 List getChildren()
          Returns the children of this node.
 int getFlags()
          Returns the modifier flags for this node.
 String getName()
          Returns the name of this node.
protected  String getName(org.eclipse.jdt.core.dom.Type 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.
 String[] getTypeParameters()
          Returns the formal type parameters for 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 class org.eclipse.emf.codegen.merge.java.facade.ast.ASTJMember
getASTBodyDeclaration, getComment, setComment
 
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.ast.ASTJNode
getASTNode, getContents, getContents, getParent, setFlags, toString
 
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.AbstractJNode
computeQualifiedName, computeQualifiedName, computeQualifiedName, dispose, getFacadeHelper, getName, getQualifiedName, getWrappedObject, setFacadeHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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
getContents, getParent, getQualifiedName, setFlags
 

Constructor Detail

ASTJType

public ASTJType(org.eclipse.jdt.core.dom.TypeDeclaration typeDeclaration)
Method Detail

getASTTypeDeclaration

protected org.eclipse.jdt.core.dom.TypeDeclaration getASTTypeDeclaration()

getSuperclass

public String getSuperclass()
Description copied from interface: JType
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>".

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

setSuperclass

public void setSuperclass(String superclassName)
Description copied from interface: JType
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>".

Specified by:
setSuperclass in interface JType
Parameters:
superclassName - the superclass name, or null if this type should have to no explicitly specified superclass

getSuperInterfaces

public String[] getSuperInterfaces()
Description copied from interface: JType
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". As of J2SE 1.5, superinterfaces 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.

Specified by:
getSuperInterfaces in interface JType
Returns:
the list of interface names, or an empty array if no interfaces are declared

getName

protected String getName(org.eclipse.jdt.core.dom.Type type)

setSuperInterfaces

public void setSuperInterfaces(String[] interfaceNames)
Description copied from interface: JType
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". As of J2SE 1.5, superinterfaces 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.

Specified by:
setSuperInterfaces in interface JType
Parameters:
interfaceNames - the list of interface names

addSuperInterface

public void addSuperInterface(String interfaceName)
Description copied from interface: JType
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.

Specified by:
addSuperInterface in interface JType
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

public String[] getTypeParameters()
Description copied from interface: JType
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".

Specified by:
getTypeParameters in interface JType
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

getName

public String getName()
Description copied from interface: JNode
Returns the name of this node.

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

computeQualifiedName

protected String computeQualifiedName()
Overrides:
computeQualifiedName in class AbstractJNode

getFlags

public int getFlags()
Description copied from interface: JNode
Returns the modifier flags for this node. The flags can be examined using class FacadeFlags.

Specified by:
getFlags in interface JNode
Overrides:
getFlags in class ASTJMember

getChildren

public List getChildren()
Description copied from interface: JNode
Returns the children of this node. Returns an empty list if this node has no children (including nodes that cannot have children). Children appear in the order in which they are declared in the source code.

The list must be unmodifiable if the implementation doesn't support direct manipulation.

Specified by:
getChildren in interface JNode
Overrides:
getChildren in class ASTJNode

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