Interface HighPrecisionMoney
- All Superinterfaces:
Comparable<javax.money.MonetaryAmount>,javax.money.CurrencySupplier,javax.money.MonetaryAmount,MonetaryAmountConvertable,Money,javax.money.NumberSupplier,TypedMoney
Object that stores money as a fraction of the smallest indivisible unit of a specific currency.
Example to create an instance using the builder pattern
HighPrecisionMoney highPrecisionMoney = HighPrecisionMoney.builder()
.centAmount(0.3)
.currencyCode("{currencyCode}")
.fractionDigits(0.3)
.preciseAmount(0.3)
.build()
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic HighPrecisionMoneyBuilderbuilder()builder factory method for HighPrecisionMoneystatic HighPrecisionMoneyBuilderbuilder(HighPrecisionMoney template) create builder for HighPrecisionMoney instancecopyDeep()default javax.money.MonetaryOperatorstatic HighPrecisionMoneydeepCopy(HighPrecisionMoney template) factory method to create a deep copy of HighPrecisionMoney@NotNull IntegerNumber of digits after the decimal separator, greater than the default number of fraction digits for a currency.@NotNull LongAmount in 1 / (10 ^fractionDigits) of a currency.static HighPrecisionMoneyof()factory methodstatic HighPrecisionMoneyof(HighPrecisionMoney template) factory method to create a shallow copy HighPrecisionMoneystatic HighPrecisionMoneyof(javax.money.MonetaryAmount monetaryAmount, int fractionDigits) voidsetFractionDigits(Integer fractionDigits) Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.voidsetPreciseAmount(Long preciseAmount) Amount in 1 / (10 ^fractionDigits) of a currency.default HighPrecisionMoneyDrafttoDraft()static com.fasterxml.jackson.core.type.TypeReference<HighPrecisionMoney>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithHighPrecisionMoney(Function<HighPrecisionMoney, T> helper) accessor map functionMethods inherited from interface javax.money.MonetaryAmount
isNegative, isNegativeOrZero, isPositive, isPositiveOrZero, isZeroMethods inherited from interface com.commercetools.api.models.common.MonetaryAmountConvertable
toMonetaryAmountMethods inherited from interface com.commercetools.api.models.common.Money
abs, add, compareTo, divide, divide, divide, divideAndRemainder, divideAndRemainder, divideAndRemainder, divideToIntegralValue, divideToIntegralValue, divideToIntegralValue, getCentAmount, getContext, getCurrency, getCurrencyCode, getFactory, getNumber, isEqualTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, multiply, multiply, multiply, negate, plus, query, remainder, remainder, remainder, scaleByPowerOfTen, setCentAmount, setCurrencyCode, signum, stripTrailingZeros, subtract, with, withMoneyMethods inherited from interface com.commercetools.api.models.common.TypedMoney
getType, withTypedMoney
-
Field Details
-
HIGH_PRECISION
discriminator value for HighPrecisionMoney- See Also:
-
-
Method Details
-
getPreciseAmount
Amount in 1 / (10 ^
fractionDigits) of a currency.- Returns:
- preciseAmount
-
getFractionDigits
Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.
- Specified by:
getFractionDigitsin interfaceTypedMoney- Returns:
- fractionDigits
-
setPreciseAmount
Amount in 1 / (10 ^
fractionDigits) of a currency.- Parameters:
preciseAmount- value to be set
-
setFractionDigits
Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.
- Specified by:
setFractionDigitsin interfaceTypedMoney- Parameters:
fractionDigits- value to be set
-
of
factory method- Returns:
- instance of HighPrecisionMoney
-
of
factory method to create a shallow copy HighPrecisionMoney- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
HighPrecisionMoney copyDeep()- Specified by:
copyDeepin interfaceTypedMoney
-
deepCopy
factory method to create a deep copy of HighPrecisionMoney- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for HighPrecisionMoney- Returns:
- builder
-
builder
create builder for HighPrecisionMoney instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withHighPrecisionMoney
accessor map function- Type Parameters:
T- mapped type- Parameters:
helper- function to map the object- Returns:
- mapped value
-
of
-
toDraft
-
createMoneyOperator
default javax.money.MonetaryOperator createMoneyOperator()- Specified by:
createMoneyOperatorin interfaceMoney- Specified by:
createMoneyOperatorin interfaceTypedMoney
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-