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")
|
@SuppressWarnings("unchecked")
|
||||||
default <T> Class<T> classForTypeName(String className) {
|
default <T> Class<T> classForTypeName(String className) {
|
||||||
switch ( className ) {
|
return (Class<T>) switch ( className ) {
|
||||||
case "boolean":
|
case "boolean" -> boolean.class;
|
||||||
return (Class<T>) boolean.class;
|
case "byte" -> byte.class;
|
||||||
case "byte":
|
case "char" -> char.class;
|
||||||
return (Class<T>) byte.class;
|
case "short" -> short.class;
|
||||||
case "char":
|
case "int" -> int.class;
|
||||||
return (Class<T>) char.class;
|
case "float" -> float.class;
|
||||||
case "short":
|
case "long" -> long.class;
|
||||||
return (Class<T>) short.class;
|
case "double" -> double.class;
|
||||||
case "int":
|
default -> classForName( className );
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -983,19 +983,15 @@ public class BasicValue extends SimpleValue implements JdbcTypeIndicators, Resol
|
||||||
public static TimeZoneStorageStrategy timeZoneStorageStrategy(
|
public static TimeZoneStorageStrategy timeZoneStorageStrategy(
|
||||||
TimeZoneStorageType timeZoneStorageType,
|
TimeZoneStorageType timeZoneStorageType,
|
||||||
MetadataBuildingContext buildingContext) {
|
MetadataBuildingContext buildingContext) {
|
||||||
if ( timeZoneStorageType != null ) {
|
return timeZoneStorageType == null
|
||||||
switch ( timeZoneStorageType ) {
|
? buildingContext.getBuildingOptions().getDefaultTimeZoneStorage()
|
||||||
case COLUMN:
|
: switch ( timeZoneStorageType ) {
|
||||||
return TimeZoneStorageStrategy.COLUMN;
|
case COLUMN -> TimeZoneStorageStrategy.COLUMN;
|
||||||
case NATIVE:
|
case NATIVE -> TimeZoneStorageStrategy.NATIVE;
|
||||||
return TimeZoneStorageStrategy.NATIVE;
|
case NORMALIZE -> TimeZoneStorageStrategy.NORMALIZE;
|
||||||
case NORMALIZE:
|
case NORMALIZE_UTC -> TimeZoneStorageStrategy.NORMALIZE_UTC;
|
||||||
return TimeZoneStorageStrategy.NORMALIZE;
|
case AUTO, DEFAULT -> buildingContext.getBuildingOptions().getDefaultTimeZoneStorage();
|
||||||
case NORMALIZE_UTC:
|
};
|
||||||
return TimeZoneStorageStrategy.NORMALIZE_UTC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return buildingContext.getBuildingOptions().getDefaultTimeZoneStorage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExplicitTypeParams(Map<String,String> explicitLocalTypeParams) {
|
public void setExplicitTypeParams(Map<String,String> explicitLocalTypeParams) {
|
||||||
|
|
Loading…
Reference in New Issue