Package org.apache.commons.jexl

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


            jc.getVars().put("theadName", sampler.getThreadName()); //$NON-NLS-1$
            jc.getVars().put("sampler", sampler); //$NON-NLS-1$
            jc.getVars().put("sampleResult", result); //$NON-NLS-1$

            // Now evaluate the expression, getting the result
            Object o = e.evaluate(jc);
            if (o != null)
            {
                str = o.toString();
            }
        } catch (Exception e)
View Full Code Here


        Expression expr = ExpressionFactory.createExpression(expression);

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

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

        return result;
View Full Code Here

                    } finally {
                        jxpathContext.setLenient(oldLenient);
                    }
                } else if (compiled instanceof Expression) {
                    Expression e = (Expression)compiled;
                    return e.evaluate(jexlContext);
                }
                return compiled;
            } catch (InvocationTargetException e) {
                Throwable t = e.getTargetException();
                if (t instanceof Exception) {
View Full Code Here

                } finally {
                    jxpathContext.setLenient(oldLenient);
                }
            } else if (compiled instanceof Expression) {
                Expression e = (Expression)compiled;
                return e.evaluate(jexlContext);
            }
            return expr.raw;
        } catch (InvocationTargetException e) {
            Throwable t = e.getTargetException();
            if (t instanceof Exception) {
View Full Code Here

                            // FIXME: workaround for JXPath bug
                            iter = val instanceof NativeArray ? new JSIntrospector.NativeArrayIterator((NativeArray)val) :
                                        compiledExpression.iteratePointers(jxpathContext);
                        } else if (expr.compiledExpression instanceof Expression) {
                            Expression e = (Expression)expr.compiledExpression;
                            Object result = e.evaluate(jexlContext);
                            if (result != null) {
                                iter = Introspector.getUberspect().getIterator(result,
                                        new Info(ev.location.getURI(), ev.location.getLineNumber(), ev.location.getColumnNumber()));
                            }
                            if (iter == null) {
View Full Code Here

                    } finally {
                        jxpathContext.setLenient(oldLenient);
                    }
                } else if (compiled instanceof Expression) {
                    Expression e = (Expression)compiled;
                    return e.evaluate(jexlContext);
                }
                return compiled;
            } catch (InvocationTargetException e) {
                Throwable t = e.getTargetException();
                if (t instanceof Exception) {
View Full Code Here

                } finally {
                    jxpathContext.setLenient(oldLenient);
                }
            } else if (compiled instanceof Expression) {
                Expression e = (Expression)compiled;
                return e.evaluate(jexlContext);
            }
            return expr.raw;
        } catch (InvocationTargetException e) {
            Throwable t = e.getTargetException();
            if (t instanceof Exception) {
View Full Code Here

                            // FIXME: workaround for JXPath bug
                            iter = val instanceof NativeArray ? new JSIntrospector.NativeArrayIterator((NativeArray)val) :
                                        compiledExpression.iteratePointers(jxpathContext);
                        } else if (expr.compiledExpression instanceof Expression) {
                            Expression e = (Expression)expr.compiledExpression;
                            Object result = e.evaluate(jexlContext);
                            if (result != null) {
                                iter = Introspector.getUberspect().getIterator(result,
                                        new Info(ev.location.getSystemId(), ev.location.getLineNumber(), ev.location.getColumnNumber()));
                            }
                            if (iter == null) {
View Full Code Here

        try {
            Expression e = ExpressionFactory.createExpression(expression);
            JexlContext jc = JexlHelper.createContext();
            jc.getVars().putAll(objectModel.getParameters());

            o = e.evaluate(jc);
        } catch (Exception e1) {
            e1.printStackTrace();
        }

        return o != null ? o.toString() : "";
View Full Code Here

    public void test_NEG1() throws Exception {
        JexlContext jc = JexlHelper.createContext();
        jc.getVars().put("A", Boolean.TRUE);
        Expression e = ExpressionFactory.createExpression("!A");
        Object actual = e.evaluate(jc);
        assertEquals(Boolean.FALSE, actual);
    }

    public void test_NEG2() throws Exception {
        JexlContext jc = JexlHelper.createContext();
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.