Search in sources :

Example 16 with AstNode

use of com.linkedin.pinot.pql.parsers.pql2.ast.AstNode in project mvel by mikebrock.

the class CoreConfidenceTests method testInterceptors.

public void testInterceptors() {
    Interceptor testInterceptor = new Interceptor() {

        public int doBefore(ASTNode node, VariableResolverFactory factory) {
            System.out.println("BEFORE Node: " + node.getName());
            return 0;
        }

        public int doAfter(Object val, ASTNode node, VariableResolverFactory factory) {
            System.out.println("AFTER Node: " + node.getName());
            return 0;
        }
    };
    Map<String, Interceptor> interceptors = new HashMap<String, Interceptor>();
    interceptors.put("test", testInterceptor);
    executeExpression(compileExpression("@test System.out.println('MIDDLE');", null, interceptors));
}
Also used : DefaultLocalVariableResolverFactory(org.mvel2.integration.impl.DefaultLocalVariableResolverFactory) VariableResolverFactory(org.mvel2.integration.VariableResolverFactory) MapVariableResolverFactory(org.mvel2.integration.impl.MapVariableResolverFactory) ASTNode(org.mvel2.ast.ASTNode) Interceptor(org.mvel2.integration.Interceptor)

Aggregations

ASTNode (org.mvel2.ast.ASTNode)11 AstNode (com.linkedin.pinot.pql.parsers.pql2.ast.AstNode)5 Interceptor (org.mvel2.integration.Interceptor)4 VariableResolverFactory (org.mvel2.integration.VariableResolverFactory)4 MapVariableResolverFactory (org.mvel2.integration.impl.MapVariableResolverFactory)4 FunctionCallAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.FunctionCallAstNode)3 IdentifierAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.IdentifierAstNode)3 HashMap (java.util.HashMap)3 BetweenPredicateAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.BetweenPredicateAstNode)2 BinaryMathOpAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.BinaryMathOpAstNode)2 BooleanOperatorAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.BooleanOperatorAstNode)2 ComparisonPredicateAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.ComparisonPredicateAstNode)2 ExpressionParenthesisGroupAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.ExpressionParenthesisGroupAstNode)2 FloatingPointLiteralAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.FloatingPointLiteralAstNode)2 GroupByAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.GroupByAstNode)2 HavingAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.HavingAstNode)2 InPredicateAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.InPredicateAstNode)2 IntegerLiteralAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.IntegerLiteralAstNode)2 IsPredicateAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.IsPredicateAstNode)2 LimitAstNode (com.linkedin.pinot.pql.parsers.pql2.ast.LimitAstNode)2