use of org.drools.modelcompiler.builder.generator.expression.EvalExpressionBuilder in project drools by kiegroup.
the class EvalVisitor method visit.
public void visit(EvalDescr descr) {
String expression = descr.getContent().toString();
DrlxParseResult drlxParseResult = ConstraintParser.withoutVariableValidationConstraintParser(context, packageModel).drlxParse(null, null, expression);
drlxParseResult.accept(drlxParseSuccess -> {
SingleDrlxParseSuccess singleResult = (SingleDrlxParseSuccess) drlxParseResult;
Expression rewriteExprAsLambdaWithoutThisParam = DrlxParseUtil.generateLambdaWithoutParameters(singleResult.getUsedDeclarations(), singleResult.getExpr(), true, Optional.empty(), context);
// rewrites the DrlxParserResult expr as directly the lambda to use
singleResult.setExpr(rewriteExprAsLambdaWithoutThisParam);
singleResult.setStatic(true);
new EvalExpressionBuilder(context).processExpression(singleResult);
});
}
Aggregations