Add feature to allow rounding off for BigDecimal type values
Issue:
The ObjectMapper currently does not allow to configure the rounding off mode in cases of BigDecimal values. So if the user wants to configure the rounding mode for all BigDecimal type values in the object, it cannot be done.
Solution:
The NumberSerialier should use the user provided rounding mode while serializing the BigDecimal values.
Although I can see the usefulness of such a setting, I am not sure of a way to expose that in general manner. But maybe this is something that can be done with 3.0 API changes.
Until then I would recommend implementing custom BigDecimal deserializer.
Still no specific feature to use (none of added, EnumFeature, DateTimeFeature, JsonNodeFeature applicable), unfortunately. And having more than 2 states prevents use of SerializationFeature.
Could change BigDecimal serializer to allow configuring, but alas there are multiple ones.
One possibility would be to consider setting for JsonGenerator but... that would have same configurability challenge I guess.
@navishsharma How would rounding mode be used, actually? Could you give sample code (assuming config option was added) to show intended use for serialization?