diff --git a/hibernate-core/src/main/java/org/hibernate/engine/config/spi/StandardConverters.java b/hibernate-core/src/main/java/org/hibernate/engine/config/spi/StandardConverters.java index af3e9a13c3..14fa38aef9 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/config/spi/StandardConverters.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/config/spi/StandardConverters.java @@ -15,7 +15,9 @@ import static org.hibernate.engine.config.spi.ConfigurationService.Converter; * @author Steve Ebersole */ public class StandardConverters { - public static final Converter BOOLEAN = (value) -> { + public static final Converter BOOLEAN = StandardConverters::asBoolean; + + public static Boolean asBoolean(Object value) { if ( value == null ) { throw new IllegalArgumentException( "Null value passed to convert" ); } @@ -23,17 +25,21 @@ public class StandardConverters { return value instanceof Boolean ? (Boolean) value : Boolean.parseBoolean( value.toString() ); - }; + } - public static final Converter STRING = (value) -> { + public static final Converter STRING = StandardConverters::asString; + + public static String asString(Object value) { if ( value == null ) { throw new IllegalArgumentException( "Null value passed to convert" ); } return value.toString(); - }; + } - public static final Converter INTEGER = (value) -> { + public static final Converter INTEGER = StandardConverters::asInteger; + + public static Integer asInteger(Object value) { if ( value == null ) { throw new IllegalArgumentException( "Null value passed to convert" ); } @@ -43,7 +49,7 @@ public class StandardConverters { } return Integer.parseInt( value.toString() ); - }; + } /** * Disallow direct instantiation