Package org.apache.commons.jexl

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


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

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

        return result != null ? result.toString() : "";
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

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

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

        return obj;
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

        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

                        currentFieldMappingIndex).getObjectToCsvExpression();
                Expression expression = ExpressionFactory
                        .createExpression(expressionString);
                csvFieldList.add(fieldMappingList.get(currentFieldMappingIndex)
                        .getCsvFieldValueFromObject(
                                expression.evaluate(jexlContext)));
                currentFieldMappingIndex++;

                if (currentFieldMappingIndex < fieldMappingList.size()) {
                    while (fieldMappingList.get(currentFieldMappingIndex)
                            .getColumnIndex() == i) {
View Full Code Here

        String expressionString = propertyName.replace(
          ARGUMENT_TOKEN, ARGUMENT_VALUE);
        Expression expression = ExpressionFactory
          .createExpression("generatedObject."
            + expressionString);
        expression.evaluate(jexlContext);
    } else {
        // TODO Throw an Exception here since not including the
        // ARGUMENT_TOKEN in the expression is a violation of the
        // updated specification.
        log.warn("Using legacy property setting method.");
View Full Code Here

                        .getExtendedContext().get(variableName);
                Expression preProcessing = ExpressionFactory
                        .createExpression(valueExpression);
                preProcessing.addPreResolver(new PoundDefineJexlResolver());
                jexlContext.getVars().put(variableName,
                        preProcessing.evaluate(jexlContext));
            }
        }

        for (int i = 0; i < lastCsvIndex; i++) {
            if (fieldMappingList.get(currentFieldMappingIndex).getColumnIndex() != i) {
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

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.