diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/spi/ClassLoaderService.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/spi/ClassLoaderService.java index ecfa22ef11..dfa732a77b 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/spi/ClassLoaderService.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/spi/ClassLoaderService.java @@ -35,26 +35,17 @@ public interface ClassLoaderService extends ResourceLocator, ResourceStreamLocat @SuppressWarnings("unchecked") default Class classForTypeName(String className) { - switch ( className ) { - case "boolean": - return (Class) boolean.class; - case "byte": - return (Class) byte.class; - case "char": - return (Class) char.class; - case "short": - return (Class) short.class; - case "int": - return (Class) int.class; - case "float": - return (Class) float.class; - case "long": - return (Class) long.class; - case "double": - return (Class) double.class; - default: - return classForName( className ); - } + return (Class) switch ( className ) { + case "boolean" -> boolean.class; + case "byte" -> byte.class; + case "char" -> char.class; + case "short" -> short.class; + case "int" -> int.class; + case "float" -> float.class; + case "long" -> long.class; + case "double" -> double.class; + default -> classForName( className ); + }; } /** diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java index 5f118a6b3f..6a06eee0cb 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java @@ -983,19 +983,15 @@ public class BasicValue extends SimpleValue implements JdbcTypeIndicators, Resol public static TimeZoneStorageStrategy timeZoneStorageStrategy( TimeZoneStorageType timeZoneStorageType, MetadataBuildingContext buildingContext) { - if ( timeZoneStorageType != null ) { - switch ( timeZoneStorageType ) { - case COLUMN: - return TimeZoneStorageStrategy.COLUMN; - case NATIVE: - return TimeZoneStorageStrategy.NATIVE; - case NORMALIZE: - return TimeZoneStorageStrategy.NORMALIZE; - case NORMALIZE_UTC: - return TimeZoneStorageStrategy.NORMALIZE_UTC; - } - } - return buildingContext.getBuildingOptions().getDefaultTimeZoneStorage(); + return timeZoneStorageType == null + ? buildingContext.getBuildingOptions().getDefaultTimeZoneStorage() + : switch ( timeZoneStorageType ) { + case COLUMN -> TimeZoneStorageStrategy.COLUMN; + case NATIVE -> TimeZoneStorageStrategy.NATIVE; + case NORMALIZE -> TimeZoneStorageStrategy.NORMALIZE; + case NORMALIZE_UTC -> TimeZoneStorageStrategy.NORMALIZE_UTC; + case AUTO, DEFAULT -> buildingContext.getBuildingOptions().getDefaultTimeZoneStorage(); + }; } public void setExplicitTypeParams(Map explicitLocalTypeParams) {