
com.jirvan.jackson.TwoDecimalPlaceDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ji-utils Show documentation
Show all versions of ji-utils Show documentation
A general java utilities library
The newest version!
package com.jirvan.jackson;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.NumberDeserializers;
import java.io.IOException;
import java.math.BigDecimal;
public class TwoDecimalPlaceDeserializer extends NumberDeserializers.BigDecimalDeserializer {
@Override
public BigDecimal deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
BigDecimal value = super.deserialize(p, ctxt);
return value == null ? null
: value.setScale(2, BigDecimal.ROUND_UNNECESSARY);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy