Example usage for org.eclipse.jdt.core.dom TypeDeclaration setSuperclass

List of usage examples for org.eclipse.jdt.core.dom TypeDeclaration setSuperclass

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom TypeDeclaration setSuperclass.

Prototype

public void setSuperclass(Name superclassName) 

Source Link

Document

Sets or clears the name of the superclass declared in this type declaration (JLS2 API only).

Usage

From source file:org.eclipse.objectteams.otdt.ui.tests.dom.rewrite.ASTRewriteFlattenerTest.java

License:Open Source License

private TypeDeclaration createTeam(Javadoc javadoc, int modifiers, boolean isInterface, boolean isRole,
        String teamClassName, String superClassName, List superInterfaces, List bodyDeclarations) {
    TypeDeclaration newTypeDecl = _newAst.newTypeDeclaration();
    newTypeDecl.setName(_newAst.newSimpleName(teamClassName));
    newTypeDecl.setTeam(true);//from   www . j  a  v  a  2  s  . co m
    newTypeDecl.modifiers().addAll(_newAst.newModifiers(modifiers));
    newTypeDecl.setRole(isRole);
    newTypeDecl.setInterface(isInterface);

    if (javadoc != null)
        newTypeDecl.setJavadoc(javadoc);

    if (superClassName != null)
        newTypeDecl.setSuperclass(_newAst.newSimpleName(superClassName));

    if (superInterfaces != null && superInterfaces.size() != 0) {
        List superInterfacesList = newTypeDecl.superInterfaces();
        for (int idx = 0; idx < superInterfaces.size(); idx++) {
            SimpleName tmp = (SimpleName) superInterfaces.get(idx);
            superInterfacesList.add(tmp);
        }
    }

    if (bodyDeclarations != null && bodyDeclarations.size() != 0) {
        List bodyDeclarationList = newTypeDecl.bodyDeclarations();
        for (int idx = 0; idx < bodyDeclarations.size(); idx++) {
            Object tmp = bodyDeclarations.get(idx);
            bodyDeclarationList.add(tmp);
        }
    }
    return newTypeDecl;
}