use switch expressions
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
5827a4fa41
commit
5adca84c43
|
@ -35,26 +35,17 @@ public interface ClassLoaderService extends ResourceLocator, ResourceStreamLocat
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
default <T> Class<T> classForTypeName(String className) {
|
||||
switch ( className ) {
|
||||
case "boolean":
|
||||
return (Class<T>) boolean.class;
|
||||
case "byte":
|
||||
return (Class<T>) byte.class;
|
||||
case "char":
|
||||
return (Class<T>) char.class;
|
||||
case "short":
|
||||
return (Class<T>) short.class;
|
||||
case "int":
|
||||
return (Class<T>) int.class;
|
||||
case "float":
|
||||
return (Class<T>) float.class;
|
||||
case "long":
|
||||
return (Class<T>) long.class;
|
||||
case "double":
|
||||
return (Class<T>) double.class;
|
||||
default:
|
||||
return classForName( className );
|
||||
}
|
||||
return (Class<T>) 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 );
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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<String,String> explicitLocalTypeParams) {
|
||||
|
|
Loading…
Reference in New Issue