From b085730dd8f8a9c9d42754a2f826d9b374082657 Mon Sep 17 00:00:00 2001 From: gavinking Date: Thu, 30 Jan 2020 18:40:22 +0100 Subject: [PATCH] Use autoboxing in BooleanTypeDescriptor --- .../type/descriptor/java/BooleanTypeDescriptor.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java index c4eb148df4..dca940c25e 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java @@ -12,9 +12,6 @@ import org.hibernate.type.descriptor.java.spi.Primitive; import org.hibernate.type.descriptor.sql.BitTypeDescriptor; import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; -import static java.lang.Boolean.FALSE; -import static java.lang.Boolean.TRUE; - /** * Descriptor for {@link Boolean} handling. * @@ -93,13 +90,13 @@ public class BooleanTypeDescriptor extends AbstractTypeDescriptor imple } if ( Number.class.isInstance( value ) ) { final int intValue = ( (Number) value ).intValue(); - return intValue == 0 ? FALSE : TRUE; + return intValue != 0; } if ( Character.class.isInstance( value ) ) { - return isTrue( (Character) value ) ? TRUE : FALSE; + return isTrue( (Character) value ); } if ( String.class.isInstance( value ) ) { - return isTrue((String) value) ? TRUE : FALSE; + return isTrue((String) value); } throw unknownWrap( value.getClass() ); } @@ -142,7 +139,7 @@ public class BooleanTypeDescriptor extends AbstractTypeDescriptor imple @Override public Boolean getDefaultValue() { - return FALSE; + return false; } @Override