Search in sources :

Example 1 with RapidsExpressionV3

use of water.api.schemas3.RapidsHelpV3.RapidsExpressionV3 in project h2o-3 by h2oai.

the class RapidsHandler method processAstClass.

private RapidsExpressionV3 processAstClass(Class<? extends AstRoot> clz, Reflections refl) {
    ArrayList<RapidsExpressionV3> subs = new ArrayList<>();
    for (Class<? extends AstRoot> subclass : refl.getSubTypesOf(clz)) if (subclass.getSuperclass() == clz)
        subs.add(processAstClass(subclass, refl));
    RapidsExpressionV3 target = new RapidsExpressionV3();
    target.name = clz.getSimpleName();
    target.is_abstract = Modifier.isAbstract(clz.getModifiers());
    if (!target.is_abstract) {
        try {
            AstRoot m = clz.newInstance();
            target.pattern = m.example();
            target.description = m.description();
        } catch (IllegalAccessException e) {
            throw H2O.fail("A");
        } catch (InstantiationException e) {
            throw H2O.fail("B");
        }
    }
    target.sub = subs.toArray(new RapidsExpressionV3[subs.size()]);
    return target;
}
Also used : ArrayList(java.util.ArrayList) RapidsExpressionV3(water.api.schemas3.RapidsHelpV3.RapidsExpressionV3) AstRoot(water.rapids.ast.AstRoot)

Aggregations

ArrayList (java.util.ArrayList)1 RapidsExpressionV3 (water.api.schemas3.RapidsHelpV3.RapidsExpressionV3)1 AstRoot (water.rapids.ast.AstRoot)1