Example usage for org.apache.commons.ognl Ognl setValue

List of usage examples for org.apache.commons.ognl Ognl setValue

Introduction

In this page you can find the example usage for org.apache.commons.ognl Ognl setValue.

Prototype

public static void setValue(String expression, Map<String, Object> context, Object root, Object value)
        throws OgnlException 

Source Link

Document

Evaluates the given OGNL expression to insert a value into the object graph rooted at the given root object given the context.

Usage

From source file:it.d4nguard.rgrpg.util.dynacast.DynaManipulator.java

/**
 * Evaluates the given OGNL expression to insert a value into the object
 * graph rooted at the given root object.
 * /*  w  w  w . ja  v  a  2 s.  co  m*/
 * @param exp
 *            the OGNL expression to be parsed
 * @param root
 *            the root object for the OGNL expression
 * @param value
 *            the value to insert into the object graph
 * @throws DynaManipulatorException
 *             if something fails below.
 */
public static void setValue(String exp, Object root, String value) throws DynaManipulatorException {
    assert root != null;
    assert value != null;
    try {
        Map<String, Object> context = Ognl.createDefaultContext(root, null, new AdapterTypeConverter());
        Ognl.setValue(exp, context, root, value);
    } catch (Exception e) {
        throw new DynaManipulatorException(e);
    }
}

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

public void setValue(OgnlContext context, Object rootObject, Object value) throws OgnlException {
    Ognl.setValue(getExpression(), context, rootObject, value);
}