Package org.apache.commons.jexl

Examples of org.apache.commons.jexl.Expression.evaluate()


        msgExpression = ExpressionFactory.createExpression("log." + _filter);

        jc.getVars().put("log", notif.getMessageInfo());
        jc.getVars().put("message", notif.getMessageInfo().getMessage());

        return ((Boolean) msgExpression.evaluate(jc));
      }
      catch (Exception e)
      {
        Log.ignore(e);
      }
View Full Code Here


      {
        MessageInfo info = it.previous();
        jc.getVars().put("log", info);
        jc.getVars().put("message", info.getMessage());
     
        if (msgExpression == null || ((Boolean) msgExpression.evaluate(jc)).booleanValue())
        {
          result.add(0, info);
          i++;
        }
      }
View Full Code Here

      {
        MessageInfo info = it.previous();
        jc.getVars().put("log", info);
        jc.getVars().put("message", info.getMessage());
     
        if (msgExpression == null || ((Boolean) msgExpression.evaluate(jc)).booleanValue())
        {
          result.add(0, info);
          i++;
        }
      }
View Full Code Here

                    try {
                        Expression e = ExpressionFactory.createExpression(
                                method.getAnnotation(Callback.class).condition());
                        JexlContext jc = JexlHelper.createContext();
                        jc.getVars().put("this", obj);
                        Object r = e.evaluate(jc);
                        if (!(r instanceof Boolean)) {
                            throw new RuntimeException("Expression did not returned a boolean value but: " + r);
                        }
                        Boolean oldVal = req.getCallbacks().get(method);
                        Boolean newVal = (Boolean) r;
View Full Code Here

        Expression expr = ExpressionFactory.createExpression(expression);

        JexlContext ctx = JexlHelper.createContext();
        ctx.setVars(vars);

        Object result = expr.evaluate(ctx);
        log.debug("Result: {}", result);

        return result;
    }   
}
View Full Code Here

        }

        log.trace("Evaluating expression: {}", expression);

        Expression expr = createExpression(expression);
        Object obj = expr.evaluate(context);
        log.trace("Result: {}", obj);

        return obj;
    }
View Full Code Here

        Expression e = ExpressionFactory.createExpression(expression);

        JexlContext jc = JexlHelper.createContext();
        jc.setVars(vars);

        return e.evaluate(jc);
    }
}
View Full Code Here

                    jc.getVars().put(entry.getKey(), entry.getValue());
                }
            }

            // Now evaluate the expression, getting the result
            result = exp.evaluate(jc);
        } catch (Exception ex) {
        }
        return result;
    }
View Full Code Here

            jexlVars.put("theadName", Thread.currentThread().getName()); //$NON-NLS-1$
            jexlVars.put("sampler", currentSampler); //$NON-NLS-1$ (may be null)
            jexlVars.put("sampleResult", previousResult); //$NON-NLS-1$ (may be null)

            // Now evaluate the expression, getting the result
            Object o = e.evaluate(jc);
            if (o != null)
            {
                str = o.toString();
            }
            if (vars != null && varName.length() > 0) {// vars will be null on TestPlan
View Full Code Here

  public boolean resolveBooleanExpression(Map<String ,Object> vars, String elExpression)
      throws Exception {
    Expression expression = ExpressionFactory.createExpression(elExpression);
    JexlContext jexlCtx = JexlHelper.createContext();
    jexlCtx.setVars(vars);
    Object obj = expression.evaluate(jexlCtx);
    return (Boolean) obj;
  }

  public void setRuntimeContext(RuntimeContext ctx) {
    rtCtx = ctx;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.