Search in sources :

Example 1 with SwitchStmtT

use of org.drools.mvelcompiler.ast.SwitchStmtT in project drools by kiegroup.

the class StatementVisitor method visit.

@Override
public TypedExpression visit(SwitchStmt n, Void arg) {
    TypedExpression typedSelector = new RHSPhase(mvelCompilerContext).invoke(n.getSelector());
    List<TypedExpression> typedEntries = n.getEntries().stream().map(e -> e.accept(this, arg)).collect(Collectors.toList());
    return new SwitchStmtT(typedSelector, typedEntries);
}
Also used : ForEachStmt(com.github.javaparser.ast.stmt.ForEachStmt) SwitchEntry(com.github.javaparser.ast.stmt.SwitchEntry) ExpressionStmt(com.github.javaparser.ast.stmt.ExpressionStmt) BlockStmtT(org.drools.mvelcompiler.ast.BlockStmtT) WhileStmt(com.github.javaparser.ast.stmt.WhileStmt) Optional.of(java.util.Optional.of) DoStmtT(org.drools.mvelcompiler.ast.DoStmtT) ForEachDowncastStmtT(org.drools.mvelcompiler.ast.ForEachDowncastStmtT) DoStmt(com.github.javaparser.ast.stmt.DoStmt) Declaration(org.drools.mvelcompiler.context.Declaration) WhileStmtT(org.drools.mvelcompiler.ast.WhileStmtT) SwitchStmt(com.github.javaparser.ast.stmt.SwitchStmt) UnalteredTypedExpression(org.drools.mvelcompiler.ast.UnalteredTypedExpression) Expression(com.github.javaparser.ast.expr.Expression) ForEachStmtT(org.drools.mvelcompiler.ast.ForEachStmtT) Node(com.github.javaparser.ast.Node) IfStmtT(org.drools.mvelcompiler.ast.IfStmtT) SwitchStmtT(org.drools.mvelcompiler.ast.SwitchStmtT) Optional.ofNullable(java.util.Optional.ofNullable) IfStmt(com.github.javaparser.ast.stmt.IfStmt) Collectors(java.util.stream.Collectors) PrintUtil(org.drools.mvel.parser.printer.PrintUtil) ForStmt(com.github.javaparser.ast.stmt.ForStmt) List(java.util.List) TypedExpression(org.drools.mvelcompiler.ast.TypedExpression) DrlGenericVisitor(org.drools.mvel.parser.ast.visitor.DrlGenericVisitor) ForStmtT(org.drools.mvelcompiler.ast.ForStmtT) Optional(java.util.Optional) MvelCompilerContext(org.drools.mvelcompiler.context.MvelCompilerContext) BlockStmt(com.github.javaparser.ast.stmt.BlockStmt) SwitchEntryT(org.drools.mvelcompiler.ast.SwitchEntryT) SwitchStmtT(org.drools.mvelcompiler.ast.SwitchStmtT) UnalteredTypedExpression(org.drools.mvelcompiler.ast.UnalteredTypedExpression) TypedExpression(org.drools.mvelcompiler.ast.TypedExpression)

Aggregations

Node (com.github.javaparser.ast.Node)1 Expression (com.github.javaparser.ast.expr.Expression)1 BlockStmt (com.github.javaparser.ast.stmt.BlockStmt)1 DoStmt (com.github.javaparser.ast.stmt.DoStmt)1 ExpressionStmt (com.github.javaparser.ast.stmt.ExpressionStmt)1 ForEachStmt (com.github.javaparser.ast.stmt.ForEachStmt)1 ForStmt (com.github.javaparser.ast.stmt.ForStmt)1 IfStmt (com.github.javaparser.ast.stmt.IfStmt)1 SwitchEntry (com.github.javaparser.ast.stmt.SwitchEntry)1 SwitchStmt (com.github.javaparser.ast.stmt.SwitchStmt)1 WhileStmt (com.github.javaparser.ast.stmt.WhileStmt)1 List (java.util.List)1 Optional (java.util.Optional)1 Optional.of (java.util.Optional.of)1 Optional.ofNullable (java.util.Optional.ofNullable)1 Collectors (java.util.stream.Collectors)1 DrlGenericVisitor (org.drools.mvel.parser.ast.visitor.DrlGenericVisitor)1 PrintUtil (org.drools.mvel.parser.printer.PrintUtil)1 BlockStmtT (org.drools.mvelcompiler.ast.BlockStmtT)1 DoStmtT (org.drools.mvelcompiler.ast.DoStmtT)1