/** * Sets the object's properties using the default type converter. * * @param props the properties being set * @param o the object * @param context the action context * @param throwPropertyExceptions boolean which tells whether it should throw exceptions for * problems setting the properties */ public void setProperties(Map<String, ?> props, Object o, Map<String, Object> context, boolean throwPropertyExceptions) throws ReflectionException{ if (props == null) { return; } Ognl.setTypeConverter(context, getTypeConverterFromContext(context)); Object oldRoot = Ognl.getRoot(context); Ognl.setRoot(context, o); for (Map.Entry<String, ?> entry : props.entrySet()) { String expression = entry.getKey(); internalSetProperty(expression, entry.getValue(), o, context, throwPropertyExceptions); } Ognl.setRoot(context, oldRoot); }
/** * Sets the named property to the supplied value on the Object. * * @param name the name of the property to be set * @param value the value to set into the named property * @param o the object upon which to set the property * @param context the context which may include the TypeConverter * @param throwPropertyExceptions boolean which tells whether it should throw exceptions for * problems setting the property */ public void setProperty(String name, Object value, Object o, Map<String, Object> context, boolean throwPropertyExceptions) { Ognl.setTypeConverter(context, getTypeConverterFromContext(context)); Object oldRoot = Ognl.getRoot(context); Ognl.setRoot(context, o); internalSetProperty(name, value, o, context, throwPropertyExceptions); Ognl.setRoot(context, oldRoot); }