Search in sources :

Example 1 with CompiledClass

use of org.finos.legend.engine.protocol.pure.v1.model.executionPlan.nodes.CompiledClass in project legend-engine by finos.

the class JavaHelper method collectJavaClasses.

private static List<JavaClass> collectJavaClasses(JavaPlatformImplementation platformImplementation) {
    if ((platformImplementation.code == null) && ((platformImplementation.byteCode == null) || platformImplementation.byteCode.isEmpty()) && ((platformImplementation.compiledClasses == null) || platformImplementation.compiledClasses.isEmpty()) && ((platformImplementation.classes == null) || platformImplementation.classes.isEmpty())) {
        return Collections.emptyList();
    }
    Map<String, JavaClass> classMap = UnifiedMap.newMap();
    if (platformImplementation.code != null) {
        String executeClassFullName = getExecutionClassFullName(platformImplementation);
        JavaClass executeClass = newJavaClass(executeClassFullName);
        executeClass.source = platformImplementation.code;
        classMap.put(executeClassFullName, executeClass);
    }
    if (platformImplementation.byteCode != null) {
        platformImplementation.byteCode.forEach((fullName, byteCode) -> {
            JavaClass newClass = newJavaClass(fullName);
            newClass.byteCode = byteCode;
            classMap.put(fullName, newClass);
        });
    }
    if (platformImplementation.compiledClasses != null) {
        for (CompiledClass compiledClass : platformImplementation.compiledClasses) {
            JavaClass newClass = newJavaClass(compiledClass.className);
            newClass.byteCode = compiledClass.byteCode;
            classMap.put(compiledClass.className, newClass);
        }
    }
    if (platformImplementation.classes != null) {
        for (JavaClass localClass : platformImplementation.classes) {
            classMap.put(getJavaClassFullName(localClass), localClass);
        }
    }
    return FastList.newList(classMap.values());
}
Also used : JavaClass(org.finos.legend.engine.protocol.pure.v1.model.executionPlan.nodes.JavaClass) CompiledClass(org.finos.legend.engine.protocol.pure.v1.model.executionPlan.nodes.CompiledClass)

Aggregations

CompiledClass (org.finos.legend.engine.protocol.pure.v1.model.executionPlan.nodes.CompiledClass)1 JavaClass (org.finos.legend.engine.protocol.pure.v1.model.executionPlan.nodes.JavaClass)1