BigDecimalJavaType and BigIntegerJavaType should support conversion to String
This commit is contained in:
parent
b4b8e955f8
commit
c829c84d55
|
@ -73,6 +73,9 @@ public class BigDecimalJavaType extends AbstractClassJavaType<BigDecimal> {
|
|||
if ( Float.class.isAssignableFrom( type ) ) {
|
||||
return (X) Float.valueOf( value.floatValue() );
|
||||
}
|
||||
if ( String.class.isAssignableFrom( type ) ) {
|
||||
return (X) value.toString();
|
||||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
|
@ -89,6 +92,9 @@ public class BigDecimalJavaType extends AbstractClassJavaType<BigDecimal> {
|
|||
if ( value instanceof Number ) {
|
||||
return BigDecimal.valueOf( ( (Number) value ).doubleValue() );
|
||||
}
|
||||
if ( value instanceof String ) {
|
||||
return new BigDecimal( (String) value );
|
||||
}
|
||||
throw unknownWrap( value.getClass() );
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,9 @@ public class BigIntegerJavaType extends AbstractClassJavaType<BigInteger> {
|
|||
if ( Float.class.isAssignableFrom( type ) ) {
|
||||
return (X) Float.valueOf( value.floatValue() );
|
||||
}
|
||||
if ( String.class.isAssignableFrom( type ) ) {
|
||||
return (X) value.toString();
|
||||
}
|
||||
throw unknownUnwrap( type );
|
||||
}
|
||||
|
||||
|
@ -88,6 +91,9 @@ public class BigIntegerJavaType extends AbstractClassJavaType<BigInteger> {
|
|||
if ( value instanceof Number ) {
|
||||
return BigInteger.valueOf( ( (Number) value ).longValue() );
|
||||
}
|
||||
if ( value instanceof String ) {
|
||||
return new BigInteger( (String) value );
|
||||
}
|
||||
throw unknownWrap( value.getClass() );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue