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
-
Method Summary
Modifier and TypeMethodDescriptionstatic HighPrecisionMoneyBuilder
builder()
builder factory method for HighPrecisionMoneystatic HighPrecisionMoneyBuilder
builder
(HighPrecisionMoney template) create builder for HighPrecisionMoney instancedefault javax.money.MonetaryOperator
static HighPrecisionMoney
deepCopy
(HighPrecisionMoney template) factory method to create a deep copy of HighPrecisionMoney@NotNull Integer
Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.@NotNull Long
Amount in 1 / (10 ^fractionDigits
) of a currency.static HighPrecisionMoney
of()
factory methodstatic HighPrecisionMoney
of
(HighPrecisionMoney template) factory method to create a shallow copy HighPrecisionMoneystatic HighPrecisionMoney
of
(javax.money.MonetaryAmount monetaryAmount, int fractionDigits) void
setFractionDigits
(Integer fractionDigits) Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.void
setPreciseAmount
(Long preciseAmount) Amount in 1 / (10 ^fractionDigits
) of a currency.default HighPrecisionMoneyDraft
toDraft()
static com.fasterxml.jackson.core.type.TypeReference<HighPrecisionMoney>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withHighPrecisionMoney
(Function<HighPrecisionMoney, T> helper) accessor map functionMethods inherited from interface javax.money.MonetaryAmount
isNegative, isNegativeOrZero, isPositive, isPositiveOrZero, isZero
Methods inherited from interface com.commercetools.api.models.common.MonetaryAmountConvertable
toMonetaryAmount
Methods 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, withMoney
Methods 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:
getFractionDigits
in 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:
setFractionDigits
in 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
-
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:
createMoneyOperator
in interfaceMoney
- Specified by:
createMoneyOperator
in interfaceTypedMoney
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-