Example usage for org.apache.commons.ognl OgnlContext put

List of usage examples for org.apache.commons.ognl OgnlContext put

Introduction

In this page you can find the example usage for org.apache.commons.ognl OgnlContext put.

Prototype

public Object put(String key, Object value) 

Source Link

Usage

From source file:pl.nask.hsn2.expressions.OgnlExpressionEvaluation.java

public Object eval() throws EvaluationException {
    if (expression == null)
        return null;
    try {//from w ww . j  a v a2 s .  co m
        LOG.debug("About to evaluate expression. Object Id={}, expression : {}", objectDataId, expression);
        OgnlContext ctx = new OgnlContext();
        CachingObjectStoreImpl cachingObjectStore = new CachingObjectStoreImpl(connector, jobId);
        OSObject root = new OSObject(cachingObjectStore, objectDataId);
        ctx.put("current", root);
        OgnlExpression expr = new OgnlExpression(expression);

        Object value = expr.evaluate(ctx, root);
        LOG.debug("Expression evaluated to value = {} ", value);

        return value;
    } catch (OgnlException e) {
        throw new EvaluationException("Error evaluating expression", e);
    }
}