Search in sources :

Example 1 with BIND_AS_CALL

use of org.drools.modelcompiler.builder.generator.ModelGenerator.BIND_AS_CALL in project drools by kiegroup.

the class AccumulateVisitorFlowDSL method buildBinding.

@Override
protected MethodCallExpr buildBinding(String bindingName, Collection<String> usedDeclaration, Expression expression) {
    MethodCallExpr bindDSL = new MethodCallExpr(null, BIND_CALL);
    bindDSL.addArgument(toVar(bindingName));
    MethodCallExpr bindAsDSL = new MethodCallExpr(bindDSL, BIND_AS_CALL);
    usedDeclaration.stream().map(d -> new NameExpr(toVar(d))).forEach(bindAsDSL::addArgument);
    bindAsDSL.addArgument(buildConstraintExpression(expression, usedDeclaration));
    return bindAsDSL;
}
Also used : PackageModel(org.drools.modelcompiler.builder.PackageModel) Parameter(org.drools.javaparser.ast.body.Parameter) Expression(org.drools.javaparser.ast.expr.Expression) ModelGeneratorVisitor(org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor) BIND_AS_CALL(org.drools.modelcompiler.builder.generator.ModelGenerator.BIND_AS_CALL) FlowExpressionBuilder(org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder) Collection(java.util.Collection) BIND_CALL(org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder.BIND_CALL) Collectors(java.util.stream.Collectors) NameExpr(org.drools.javaparser.ast.expr.NameExpr) DrlxParseUtil.fromVar(org.drools.modelcompiler.builder.generator.DrlxParseUtil.fromVar) ArrayList(java.util.ArrayList) RuleContext(org.drools.modelcompiler.builder.generator.RuleContext) List(java.util.List) MethodCallExpr(org.drools.javaparser.ast.expr.MethodCallExpr) DrlxParseUtil.toVar(org.drools.modelcompiler.builder.generator.DrlxParseUtil.toVar) Optional(java.util.Optional) LambdaExpr(org.drools.javaparser.ast.expr.LambdaExpr) NameExpr(org.drools.javaparser.ast.expr.NameExpr) MethodCallExpr(org.drools.javaparser.ast.expr.MethodCallExpr)

Aggregations

ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 Parameter (org.drools.javaparser.ast.body.Parameter)1 Expression (org.drools.javaparser.ast.expr.Expression)1 LambdaExpr (org.drools.javaparser.ast.expr.LambdaExpr)1 MethodCallExpr (org.drools.javaparser.ast.expr.MethodCallExpr)1 NameExpr (org.drools.javaparser.ast.expr.NameExpr)1 PackageModel (org.drools.modelcompiler.builder.PackageModel)1 DrlxParseUtil.fromVar (org.drools.modelcompiler.builder.generator.DrlxParseUtil.fromVar)1 DrlxParseUtil.toVar (org.drools.modelcompiler.builder.generator.DrlxParseUtil.toVar)1 BIND_AS_CALL (org.drools.modelcompiler.builder.generator.ModelGenerator.BIND_AS_CALL)1 RuleContext (org.drools.modelcompiler.builder.generator.RuleContext)1 FlowExpressionBuilder (org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder)1 BIND_CALL (org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder.BIND_CALL)1 ModelGeneratorVisitor (org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor)1