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

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

Introduction

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

Prototype

public List superInterfaces() 

Source Link

Document

Returns the live ordered list of names of superinterfaces of this type declaration (JLS2 API only).

Usage

From source file:lang.java.jdt.internal.JdtAstToRascalAstConverter.java

License:Open Source License

public boolean visit(TypeDeclaration node) {
    java.util.Map.Entry<IValueList, IValueList> extendedModifiers = parseExtendedModifiers(node);
    IValue objectType = node.isInterface() ? values.string("interface") : values.string("class");
    IValue name = values.string(node.getName().getFullyQualifiedName());

    IValueList genericTypes = new IValueList(values);
    if (node.getAST().apiLevel() >= AST.JLS3) {
        if (!node.typeParameters().isEmpty()) {
            for (Iterator it = node.typeParameters().iterator(); it.hasNext();) {
                TypeParameter t = (TypeParameter) it.next();
                genericTypes.add(visitChild(t));
            }/*w  w  w. jav  a  2  s.  c  om*/
        }
    }

    IValue extendsClass = null;
    IValueList implementsInterfaces = new IValueList(values);

    if (node.getAST().apiLevel() == AST.JLS2) {
        if (node.getSuperclass() != null) {
            extendsClass = visitChild(node.getSuperclass());
        }
        if (!node.superInterfaces().isEmpty()) {
            for (Iterator it = node.superInterfaces().iterator(); it.hasNext();) {
                Name n = (Name) it.next();
                implementsInterfaces.add(visitChild(n));
            }
        }
    } else if (node.getAST().apiLevel() >= AST.JLS3) {
        if (node.getSuperclassType() != null) {
            extendsClass = visitChild(node.getSuperclassType());
        }
        if (!node.superInterfaceTypes().isEmpty()) {
            for (Iterator it = node.superInterfaceTypes().iterator(); it.hasNext();) {
                Type t = (Type) it.next();
                implementsInterfaces.add(visitChild(t));
            }
        }
    }

    IValueList bodyDeclarations = new IValueList(values);
    for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext();) {
        BodyDeclaration d = (BodyDeclaration) it.next();
        bodyDeclarations.add(visitChild(d));
    }

    ownValue = constructRascalNode(node, extendedModifiers.getKey().asList(),
            extendedModifiers.getValue().asList(), objectType, name, genericTypes.asList(),
            optional(extendsClass), implementsInterfaces.asList(), bodyDeclarations.asList());
    return false;
}

From source file:org.codemucker.jmutate.ast.JAstFlattener.java

License:Open Source License

/**
 * Internal synonym for {@link TypeDeclaration#superInterfaces()}. Use to
 * alleviate deprecation warnings./* ww w.  j  a  v a 2 s  .  c  om*/
 * 
 * @deprecated
 * @since 3.4
 */
private List superInterfaces(TypeDeclaration node) {
    return node.superInterfaces();
}

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  ww w.j a v  a2s.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;
}