-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
Currently using 2.9.6; have searched and don't see any planned changes in this area.
Basically, I would like this test to pass by default:
private static class BigDecimalWrapper {
public final BigDecimal value;
public BigDecimalWrapper(BigDecimal value) { this.value = value; }
}
@Test
public void createFromBigDecimal() throws IOException {
assertThat(new ObjectMapper().readValue("42.5", BigDecimalWrapper.class).value, is(new BigDecimal("42.5")));
}the same way that this one does:
private static class DoubleWrapper {
public final Double value;
public DoubleWrapper(Double value) { this.value = value; }
}
@Test
public void createFromDouble() throws IOException {
assertThat(new ObjectMapper().readValue("42.5", DoubleWrapper.class).value, is(new Double("42.5")));
}Currently, StdValueInstantiator does not support BigDecimal (or BigInteger) at all. I would like to add support for BigDecimal creators to createFromDouble, createFromLong, and createFromInt (and BigInteger creators to createFromLong and createFromInt) in StdValueInstantiator as widening conversions, the same way that createFromInt supports using long creators as a widening conversion.
Metadata
Metadata
Assignees
Labels
No labels