/** * Set multiple properties of a bean at once using a Map. Any unknown properties * shall be ignored. * * @param obj The object to be manipulated. * @param valueMap Map containing property-name (String) / property-value (Object) * pairs to set in the object. * @param allowedProperties If array is NOT null, only the properties matching names * passed here shall be set. */ public final static void setValues(Object obj, Map valueMap, String[] allowedProperties) { Iterator keys = valueMap.keySet().iterator(); while (keys.hasNext()) { String property = keys.next().toString(); Object value = valueMap.get(property); if (allowed(property, allowedProperties)) { setValue(obj, property, value); } } }
/** * Set multiple properties of a bean at once using a Map. Any unknown properties * shall be ignored. * * @param obj The object to be manipulated. * @param valueMap Map containing property-name (String) / property-value (Object) * pairs to set in the object. * @param allowedProperties If array is NOT null, only the properties matching names * passed here shall be set. */ public final static void setValues(Object obj, Map valueMap, String[] allowedProperties) { Iterator keys = valueMap.keySet().iterator(); while (keys.hasNext()) { String property = keys.next().toString(); Object value = valueMap.get(property); if (allowed(property, allowedProperties)) { setValue(obj, property, value); } } }