public Object getValue(final String name, final Map<String, Object> context, final Object root, final Class resultType) throws OgnlException { return compileAndExecute(name, context, new OgnlTask<Object>() { public Object execute(Object tree) throws OgnlException { return Ognl.getValue(tree, context, root, resultType); } }); }
public Object getValue(final String name, final Map<String, Object> context, final Object root) throws OgnlException { return compileAndExecute(name, context, new OgnlTask<Object>() { public Object execute(Object tree) throws OgnlException { return Ognl.getValue(tree, context, root); } }); }
public Object compile(String expression, Map<String, Object> context) throws OgnlException { return compileAndExecute(expression,context,new OgnlTask<Object>() { public Object execute(Object tree) throws OgnlException { return tree; } }); }
/** * Wrapper around Ognl.setValue() to handle type conversion for collection elements. * Ideally, this should be handled by OGNL directly. */ public void setValue(final String name, final Map<String, Object> context, final Object root, final Object value) throws OgnlException { compileAndExecute(name, context, new OgnlTask<Void>() { public Void execute(Object tree) throws OgnlException { if (isEvalExpression(tree, context)) { throw new OgnlException("Eval expression/chained expressions cannot be used as parameter name"); } if (isArithmeticExpression(tree, context)) { throw new OgnlException("Arithmetic expressions cannot be used as parameter name"); } Ognl.setValue(tree, context, root, value); return null; } }); }
Method readMethod = propertyDescriptor.getReadMethod(); if (readMethod != null) { final Object value = compileAndExecute(propertyName, null, new OgnlTask<Object>() { public Object execute(Object expr) throws OgnlException { return Ognl.getValue(expr, sourceMap, source);
if ((toPd != null) && (toPd.getWriteMethod() != null)) { try { compileAndExecute(fromPd.getName(), context, new OgnlTask<Object>() { public Void execute(Object expr) throws OgnlException { Object value = Ognl.getValue(expr, contextFrom, from);