public static void setProperties(Object bean, Map<String, String> properties) {
        try {
            // Loop through all the property names in the Map
            for (String propName : properties.keySet()) {
                try {
                    // Create a property descriptor for the named property. If
                    // the bean doesn't have the named property, an
                    // Introspection will be thrown.
                    PropertyDescriptor descriptor = new PropertyDescriptor(
                            propName, bean.getClass());
                    // Load the class type of the property.
                    Class<?> propertyType = descriptor.getPropertyType();
                    // Get the value of the property by converting it from a
                    // String to the correct object type.
                    Object value = decode(propertyType, properties.get(propName));
                    // Set the value of the bean.
                    descriptor.getWriteMethod().invoke(bean, value);
                }
                catch (IntrospectionException ie) {
                    // Ignore. This exception means that the key in the map
                    // does not correspond to a property of the bean.
                }
                catch (InvocationTargetException ite) {
                    // Ignore. This exception most often occurs when a
                    // value in the map is null and the target method doesn't
                    // support null properties.
                }
            }
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
        }
    }
Sets the properties of a Java Bean based on the String name/value pairs in
the specified Map. Because this method has to know how to convert a
String value into the correct type for the bean, only a few bean property
types are supported. They are: String, boolean, int, long, float, double,
Color, and Class.<p>

If key/value pairs exist in the Map that don't correspond to properties
of the bean, they will be ignored.

@param bean the JavaBean to set properties on.
@param properties String name/value pairs of the properties to set.
xmppserver/src/main/java/org/jivesoftware/util/BeanUtils.java