base/common/src/main/com/thesett/common/reflect/BeanMemento.java
public static void restoreValues(Object ob, Map<String, Object> values) throws NoSuchFieldException
    {
        /*log.fine("public void restore(Object ob): called");*/
        /*log.fine("Object to restore to has the type: " + ob.getClass());*/

        // Get the class of th object to restore to.
        Class obClass = ob.getClass();

        // Loop over all the stored properties.
        for (String propName : values.keySet())
        {
            // Get the cached property from this mementos store.
            Object nextValue = values.get(propName);
            /*log.fine("Next property to restore is: " + propName);*/
            /*log.fine("Next value to restore is: " + nextValue);*/

            // Used to hold the value to set.
            Object paramValue;

            // Used to hold the type of the value to set.
            Class paramType;

            // Check if the value store is a null.
            if (nextValue == null)
            {
                paramValue = null;
                paramType = null;
            }

            // Check if the value to store is a multi type data object.
            else if (nextValue instanceof TypeConverter.MultiTypeData)
            {
                /*log.fine("The value to restore is a multi typed data object.");*/

                TypeConverter.MultiTypeData multiValue = (TypeConverter.MultiTypeData) nextValue;

                // Get the types (classes) of all the possible 'setter' methods for the property.
                Set<Class> setterTypes = ReflectionUtils.findMatchingSetters(ob.getClass(), propName);
                /*log.fine("setterTypes = " + setterTypes);*/

                // Use the type converter to get the best matching type with the multi data.
                paramType = TypeConverter.bestMatchingConversion(multiValue, setterTypes);

                // Convert the multi data to an object of the appropriate type.
                paramValue = TypeConverter.convert(multiValue, paramType);
            }

            // The value to store is not a multi type.
            else
            {
                /*log.fine("The value to restore is a simply typed data object.");*/

                // Get the type and value of the plain type to set.
                paramValue = nextValue;
                paramType = nextValue.getClass();
            }

            /*log.fine("paramValue = " + paramValue);*/
            /*log.fine("paramType = " + paramType);*/

            // Call the setter method with the new property value, checking first that the property has a matching
            // 'setter' method.
            Method setterMethod;

            try
            {
                // Convert the first letter of the property name to upper case to match against the upper case version
                // of it that will be in the setter method name. For example the property test will have a setter method
                // called setTest.
                String upperPropertyName = Character.toUpperCase(propName.charAt(0)) + propName.substring(1);

                // Try to find an appropriate setter method on the object to call.
                setterMethod = obClass.getMethod("set" + upperPropertyName, paramType);

                // Call the setter method with the new property value.
                Object[] params = new Object[] { paramValue };
                setterMethod.invoke(ob, params);
            }
            catch (NoSuchMethodException e)
            {
                // Do nothing as properties may have getters but no setter for read only properties.
                /*log.log(java.util.logging.Level.FINE, "A setter method could not be found for " + propName + ".", e);*/

                /*
                // The object does not have a matching setter method for the type.
                NoSuchFieldException nsfe = new NoSuchFieldException("The object does not have a matching setter " +
                                                                     "method 'set" + propName + "'.");
                nsfe.initCause(e);
                throw nsfe;
                */
            }
            catch (IllegalAccessException e)
            {
                /*log.log(java.util.logging.Level.FINE, "IllegalAccessException during call to setter method.", e);*/
            }
            catch (InvocationTargetException e)
            {
                /*log.log(java.util.logging.Level.FINE, "InvocationTargetException during call to setter method.", e);*/
            }
        }
    }
public static void restoreValues(Object ob, Map<String, Object> values) throws NoSuchFieldException
    {
        /*log.fine("public void restore(Object ob): called");*/
        /*log.fine("Object to restore to has the type: " + ob.getClass());*/

        // Get the class of th object to restore to.
        Class obClass = ob.getClass();

        // Loop over all the stored properties.
        for (String propName : values.keySet())
        {
            // Get the cached property from this mementos store.
            Object nextValue = values.get(propName);
            /*log.fine("Next property to restore is: " + propName);*/
            /*log.fine("Next value to restore is: " + nextValue);*/

            // Used to hold the value to set.
            Object paramValue;

            // Used to hold the type of the value to set.
            Class paramType;

            // Check if the value store is a null.
            if (nextValue == null)
            {
                paramValue = null;
                paramType = null;
            }

            // Check if the value to store is a multi type data object.
            else if (nextValue instanceof TypeConverter.MultiTypeData)
            {
                /*log.fine("The value to restore is a multi typed data object.");*/

                TypeConverter.MultiTypeData multiValue = (TypeConverter.MultiTypeData) nextValue;

                // Get the types (classes) of all the possible 'setter' methods for the property.
                Set<Class> setterTypes = ReflectionUtils.findMatchingSetters(ob.getClass(), propName);
                /*log.fine("setterTypes = " + setterTypes);*/

                // Use the type converter to get the best matching type with the multi data.
                paramType = TypeConverter.bestMatchingConversion(multiValue, setterTypes);

                // Convert the multi data to an object of the appropriate type.
                paramValue = TypeConverter.convert(multiValue, paramType);
            }

            // The value to store is not a multi type.
            else
            {
                /*log.fine("The value to restore is a simply typed data object.");*/

                // Get the type and value of the plain type to set.
                paramValue = nextValue;
                paramType = nextValue.getClass();
            }

            /*log.fine("paramValue = " + paramValue);*/
            /*log.fine("paramType = " + paramType);*/

            // Call the setter method with the new property value, checking first that the property has a matching
            // 'setter' method.
            Method setterMethod;

            try
            {
                // Convert the first letter of the property name to upper case to match against the upper case version
                // of it that will be in the setter method name. For example the property test will have a setter method
                // called setTest.
                String upperPropertyName = Character.toUpperCase(propName.charAt(0)) + propName.substring(1);

                // Try to find an appropriate setter method on the object to call.
                setterMethod = obClass.getMethod("set" + upperPropertyName, paramType);

                // Call the setter method with the new property value.
                Object[] params = new Object[] { paramValue };
                setterMethod.invoke(ob, params);
            }
            catch (NoSuchMethodException e)
            {
                // Do nothing as properties may have getters but no setter for read only properties.
                /*log.log(java.util.logging.Level.FINE, "A setter method could not be found for " + propName + ".", e);*/

                /*
                // The object does not have a matching setter method for the type.
                NoSuchFieldException nsfe = new NoSuchFieldException("The object does not have a matching setter " +
                                                                     "method 'set" + propName + "'.");
                nsfe.initCause(e);
                throw nsfe;
                */
            }
            catch (IllegalAccessException e)
            {
                /*log.log(java.util.logging.Level.FINE, "IllegalAccessException during call to setter method.", e);*/
            }
            catch (InvocationTargetException e)
            {
                /*log.log(java.util.logging.Level.FINE, "InvocationTargetException during call to setter method.", e);*/
            }
        }
    }
Restores the properties currently in this memento to the specified object.

@param  ob     The object to which the values from this memento should be restored.
@param  values The map of values to restore.

@throws NoSuchFieldException If a setter method could not be found for a property.