Search in sources :

Example 1 with HasTypeParameters

use of org.abs_models.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(org.abs_models.frontend.ast.TypeParameterDecl) HasTypeParameters(org.abs_models.frontend.ast.HasTypeParameters) ABSValue(org.abs_models.backend.java.lib.types.ABSValue)

Aggregations

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