liquibase.configuration.ConfigurationValueUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
The newest version!
package liquibase.configuration;
import liquibase.Scope;
import liquibase.util.ObjectUtil;
import java.util.concurrent.atomic.AtomicReference;
public class ConfigurationValueUtils {
/**
*
* Call the convert method with the argument key in the current scope
* so that it can be used in an error message
* @param key The name of the argument
* @param value The argument value
* @param converter The converter method
* @return
*
*/
public static T convertDataType(String key, T value, ConfigurationValueConverter converter) {
AtomicReference reference = new AtomicReference<>();
try {
Scope.child(ObjectUtil.ARGUMENT_KEY, key, () ->
reference.set(converter.convert(value)));
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
return reference.get();
}
}