package org.hibernate.engine.config.spi;
import static org.hibernate.engine.config.spi.ConfigurationService.Converter;
public class StandardConverters {
public static final Converter<Boolean> BOOLEAN = new Converter<Boolean>() {
@Override
public Boolean convert(Object value) {
if ( value == null ) {
throw new IllegalArgumentException( "Null value passed to convert" );
}
return Boolean.class.isInstance( value )
? Boolean.class.cast( value )
: Boolean.parseBoolean( value.toString() );
}
};
public static final Converter<String> STRING = new Converter<String>() {
@Override
public String convert(Object value) {
if ( value == null ) {
throw new IllegalArgumentException( "Null value passed to convert" );
}
return value.toString();
}
};
private StandardConverters() {
}
}