HHH-17726 Cleanup java types missing same type in wrap/unwrap

This commit is contained in:
Marco Belladelli 2024-02-13 11:13:31 +01:00
parent 7f51c13fcf
commit 6f00449af1
3 changed files with 19 additions and 5 deletions

View File

@ -44,6 +44,9 @@ public class TimeZoneJavaType extends AbstractClassJavaType<TimeZone> {
if ( value == null ) {
return null;
}
if ( TimeZone.class.isAssignableFrom( type ) ) {
return (X) value;
}
if ( String.class.isAssignableFrom( type ) ) {
return (X) toString( value );
}
@ -54,7 +57,10 @@ public class TimeZoneJavaType extends AbstractClassJavaType<TimeZone> {
if ( value == null ) {
return null;
}
if (value instanceof CharSequence) {
if ( value instanceof TimeZone ) {
return (TimeZone) value;
}
if ( value instanceof CharSequence ) {
return fromString( (CharSequence) value );
}
throw unknownWrap( value.getClass() );

View File

@ -47,11 +47,12 @@ public class ZoneIdJavaType extends AbstractClassJavaType<ZoneId> {
if ( value == null ) {
return null;
}
if ( ZoneId.class.isAssignableFrom( type ) ) {
return (X) value;
}
if ( String.class.isAssignableFrom( type ) ) {
return (X) toString( value );
}
throw unknownUnwrap( type );
}
@ -60,11 +61,12 @@ public class ZoneIdJavaType extends AbstractClassJavaType<ZoneId> {
if ( value == null ) {
return null;
}
if ( value instanceof ZoneId ) {
return (ZoneId) value;
}
if ( value instanceof String ) {
return fromString( (String) value );
}
throw unknownWrap( value.getClass() );
}

View File

@ -53,6 +53,9 @@ public class ZoneOffsetJavaType extends AbstractClassJavaType<ZoneOffset> {
if ( value == null ) {
return null;
}
if ( ZoneOffset.class.isAssignableFrom( type ) ) {
return (X) value;
}
if ( String.class.isAssignableFrom( type ) ) {
return (X) toString( value );
}
@ -67,6 +70,9 @@ public class ZoneOffsetJavaType extends AbstractClassJavaType<ZoneOffset> {
if ( value == null ) {
return null;
}
if ( value instanceof ZoneOffset ) {
return (ZoneOffset) value;
}
if ( value instanceof CharSequence ) {
return fromString( (CharSequence) value );
}