protected Object valueOf ( Object value ) { if ( value == null ) { return value ; } else if ( type . isAssignableFrom ( value . getClass ( ) ) ) { return value ; } else if ( value instanceof String ) { if ( type . equals ( Boolean . class ) ) { return Boolean . valueOf ( ( String ) value ) ; } else if ( type . equals ( Integer . class ) ) { return Integer . valueOf ( ( String ) value ) ; } else if ( type . equals ( BigDecimal . class ) ) { return new BigDecimal ( ( String ) value ) ; } else if ( type . equals ( Long . class ) ) { return Long . valueOf ( ( String ) value ) ; } else if ( type . equals ( List . class ) ) { return StringUtil . splitAndTrim ( ( String ) value , "," ) ; } else { throw new UnexpectedLiquibaseException ( "Cannot parse property " + value . getClass ( ) . getSimpleName ( ) + " to a " + type . getSimpleName ( ) ) ; } } else { throw new UnexpectedLiquibaseException ( "Could not convert " + value . getClass ( ) . getSimpleName ( ) + " to a " + type . getSimpleName ( ) ) ; } }
Converts an object of a different type to the type used by this property . If types are not convertible an exception is thrown .