Code example for MutablePropertyValues

0
	 * Sets properties from the given Map. 
	 * @see MutablePropertyValues#addPropertyValues(Map) 
	 * @since 8.0 
	 */ 
	public static void setProperties(Object bean, Map<String, ?> properties) {
		new BeanWrapperImpl(bean).setPropertyValues(new MutablePropertyValues(properties));
	} 
 
	@SuppressWarnings("unchecked") 
	public static<T> T convert(String s, Class<T> targetClass) {
		if (targetClass.equals(String.class)) {
			return (T) s;
		} 
		PropertyEditor pe = registry.findEditor(targetClass);
		Assert.notNull(pe, "No PropertyEditor found for class: " + targetClass);
		synchronized (pe) {
			pe.setAsText(s);
			return (T) pe.getValue();
		} 
	}