Class MonetaryToBigDecimalConverter
java.lang.Object
com.fasterxml.jackson.databind.util.StdConverter<javax.money.MonetaryAmount,BigDecimal>
com.broadleafcommerce.money.jackson.MonetaryToBigDecimalConverter
- All Implemented Interfaces:
com.fasterxml.jackson.databind.util.Converter<javax.money.MonetaryAmount,
BigDecimal>
public class MonetaryToBigDecimalConverter
extends com.fasterxml.jackson.databind.util.StdConverter<javax.money.MonetaryAmount,BigDecimal>
On an incoming deserialization request, we should not trust the currency coming in at all and
instead only look at the value. However, we do want to support the MonetaryValue
shape to
make it easy for clients using the API to serialize results to. This allows us to take in a
deserialization request that looks like a MonetaryAmount
but still set just the
BigDecimal
as the property.
Note that this will only accept JSON that looks like a Money (nested object). If you want to
support both nested and non-nested values, consider OptionalMonetaryAmountDeserializer
- Author:
- Phillip Verheyden (phillipuniverse)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.util.Converter
com.fasterxml.jackson.databind.util.Converter.None
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.fasterxml.jackson.databind.util.StdConverter
_findConverterType, getInputType, getOutputType
-
Constructor Details
-
MonetaryToBigDecimalConverter
public MonetaryToBigDecimalConverter()
-
-
Method Details
-
convert
- Specified by:
convert
in interfacecom.fasterxml.jackson.databind.util.Converter<javax.money.MonetaryAmount,
BigDecimal> - Specified by:
convert
in classcom.fasterxml.jackson.databind.util.StdConverter<javax.money.MonetaryAmount,
BigDecimal>
-