Search in sources :

Example 1 with ExecModelLambdaPostProcessor

use of org.drools.modelcompiler.util.lambdareplace.ExecModelLambdaPostProcessor in project drools by kiegroup.

the class RuleWriter method getRuleSources.

public List<RuleFileSource> getRuleSources() {
    List<RuleFileSource> rules = new ArrayList<>();
    for (CompilationUnit cu : rulesSource.getModelClasses()) {
        final Optional<ClassOrInterfaceDeclaration> classOptional = cu.findFirst(ClassOrInterfaceDeclaration.class);
        if (classOptional.isPresent()) {
            String addFileName = classOptional.get().getNameAsString();
            if (EXTERNALIZE_LAMBDAS && pkgModel.getConfiguration().isExternaliseCanonicalModelLambda()) {
                new ExecModelLambdaPostProcessor(pkgModel, cu).convertLambdas();
                if (checkNonExternalisedLambda) {
                    checkNonExternalisedLambda(cu);
                }
                rules.add(new RuleFileSource(addFileName, cu));
            } else {
                rules.add(new RuleFileSource(addFileName, cu));
            }
        }
    }
    return rules;
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) ClassOrInterfaceDeclaration(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration) ArrayList(java.util.ArrayList) ExecModelLambdaPostProcessor(org.drools.modelcompiler.util.lambdareplace.ExecModelLambdaPostProcessor)

Aggregations

CompilationUnit (com.github.javaparser.ast.CompilationUnit)1 ClassOrInterfaceDeclaration (com.github.javaparser.ast.body.ClassOrInterfaceDeclaration)1 ArrayList (java.util.ArrayList)1 ExecModelLambdaPostProcessor (org.drools.modelcompiler.util.lambdareplace.ExecModelLambdaPostProcessor)1