liquibase-core/src/main/java/liquibase/util/ObjectUtil.java
public static void setProperty(Object object, String propertyName, Object propertyValue) {
        Method method = getWriteMethod(object, propertyName);
        if (method == null) {
            throw new UnexpectedLiquibaseException (
                String.format("Property [%s] was not found for object type [%s]", propertyName,
                    object.getClass().getName()
                ));
        }

        try {
            if (propertyValue == null) {
                setProperty(object, propertyName, null);
                return;
            }
            if (!method.getParameterTypes()[0].isAssignableFrom(propertyValue.getClass())) {
                setProperty(object, propertyName, propertyValue.toString());
                return;
            }

            method.invoke(object, propertyValue);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new UnexpectedLiquibaseException(e);
        } catch (IllegalArgumentException e) {
            throw new UnexpectedLiquibaseException("Cannot call " + method.toString() + " with value of type "
                + (propertyValue == null ? "null" : propertyValue.getClass().getName()));
        }
    }
public static void setProperty(Object object, String propertyName, Object propertyValue) {
        Method method = getWriteMethod(object, propertyName);
        if (method == null) {
            throw new UnexpectedLiquibaseException (
                String.format("Property [%s] was not found for object type [%s]", propertyName,
                    object.getClass().getName()
                ));
        }

        try {
            if (propertyValue == null) {
                setProperty(object, propertyName, null);
                return;
            }
            if (!method.getParameterTypes()[0].isAssignableFrom(propertyValue.getClass())) {
                setProperty(object, propertyName, propertyValue.toString());
                return;
            }

            method.invoke(object, propertyValue);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new UnexpectedLiquibaseException(e);
        } catch (IllegalArgumentException e) {
            throw new UnexpectedLiquibaseException("Cannot call " + method.toString() + " with value of type "
                + (propertyValue == null ? "null" : propertyValue.getClass().getName()));
        }
    }
public static void setProperty ( Object object , String propertyName , Object propertyValue ) { Method method = getWriteMethod ( object , propertyName ) ; if ( method == null ) { throw new UnexpectedLiquibaseException ( String . format ( "Property [%s] was not found for object type [%s]" , propertyName , object . getClass ( ) . getName ( ) ) ) ; } try { if ( propertyValue == null ) { setProperty ( object , propertyName , null ) ; return ; } if ( ! method . getParameterTypes ( ) [ 0 ] . isAssignableFrom ( propertyValue . getClass ( ) ) ) { setProperty ( object , propertyName , propertyValue . toString ( ) ) ; return ; } method . invoke ( object , propertyValue ) ; } catch ( IllegalAccessException | InvocationTargetException e ) { throw new UnexpectedLiquibaseException ( e ) ; } catch ( IllegalArgumentException e ) { throw new UnexpectedLiquibaseException ( "Cannot call " + method . toString ( ) + " with value of type " + ( propertyValue == null ? "null" : propertyValue . getClass ( ) . getName ( ) ) ) ; } }
Sets the selected property of the given object to propertyValue. A run-time exception will occur if the
type of value is incompatible with the reader/writer method signatures of the given propertyName.
@param object                        the object whose property should be set
@param propertyName                  name of the property to set
@param propertyValue                 new value of the property
Sets the selected property of the given object to propertyValue . A run - time exception will occur if the type of value is incompatible with the reader / writer method signatures of the given propertyName .