Search in sources :

Example 1 with HasTypeParameters

use of abs.frontend.ast.HasTypeParameters in project abstools by abstools.

the class JavaGeneratorHelper method generateTypeParameters.

public static void generateTypeParameters(PrintStream stream, Decl dtd, boolean plusExtends) {
    List<TypeParameterDecl> typeParams = null;
    if (dtd instanceof HasTypeParameters) {
        typeParams = ((HasTypeParameters) dtd).getTypeParameters();
    } else
        return;
    if (typeParams.getNumChild() > 0) {
        stream.print("<");
        boolean isFirst = true;
        for (TypeParameterDecl d : typeParams) {
            if (isFirst)
                isFirst = false;
            else
                stream.print(",");
            stream.print(d.getName());
            if (plusExtends)
                stream.print(" extends " + ABSValue.class.getName());
        }
        stream.print(">");
    }
}
Also used : TypeParameterDecl(abs.frontend.ast.TypeParameterDecl) HasTypeParameters(abs.frontend.ast.HasTypeParameters) ABSValue(abs.backend.java.lib.types.ABSValue)

Aggregations

ABSValue (abs.backend.java.lib.types.ABSValue)1 HasTypeParameters (abs.frontend.ast.HasTypeParameters)1 TypeParameterDecl (abs.frontend.ast.TypeParameterDecl)1