Interface TypedMoneyDraft
- All Superinterfaces:
Comparable<javax.money.MonetaryAmount>
,javax.money.CurrencySupplier
,javax.money.MonetaryAmount
,MonetaryAmountConvertable
,Money
,javax.money.NumberSupplier
- All Known Subinterfaces:
CentPrecisionMoneyDraft
,HighPrecisionMoneyDraft
Base polymorphic money type containing common fields for Money and HighPrecisionMoneyDraft.
- To set money in cent precision, use Money.
- To set money in high precision, use HighPrecisionMoneyDraft.
Example to create a subtype instance using the builder pattern
TypedMoneyDraft typedMoneyDraft = TypedMoneyDraft.centPrecisionBuilder()
currencyCode("{currencyCode}")
.build()
-
Method Summary
Modifier and TypeMethodDescriptionbuilder for centPrecision subtypedefault javax.money.MonetaryOperator
static TypedMoneyDraft
deepCopy
(TypedMoneyDraft template) factory method to create a deep copy of TypedMoneyDraftAmount in the smallest indivisible unit of a currency.Number of fraction digits for a specified money.getType()
Determines the type of money used.builder for highPrecision subtypevoid
setCentAmount
(Long centAmount) Amount in the smallest indivisible unit of a currency.void
setFractionDigits
(Integer fractionDigits) Number of fraction digits for a specified money.static com.fasterxml.jackson.core.type.TypeReference<TypedMoneyDraft>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withTypedMoneyDraft
(Function<TypedMoneyDraft, 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, getContext, getCurrency, getCurrencyCode, getFactory, getNumber, isEqualTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, multiply, multiply, multiply, negate, plus, query, remainder, remainder, remainder, scaleByPowerOfTen, setCurrencyCode, signum, stripTrailingZeros, subtract, toDraft, with, withMoney
-
Method Details
-
getType
MoneyType getType()Determines the type of money used.
- Returns:
- type
-
getFractionDigits
Integer getFractionDigits()Number of fraction digits for a specified money.
- Returns:
- fractionDigits
-
getCentAmount
Long getCentAmount()Amount in the smallest indivisible unit of a currency.
- Specified by:
getCentAmount
in interfaceMoney
- Returns:
- centAmount
-
setFractionDigits
Number of fraction digits for a specified money.
- Parameters:
fractionDigits
- value to be set
-
setCentAmount
Amount in the smallest indivisible unit of a currency.
- Specified by:
setCentAmount
in interfaceMoney
- Parameters:
centAmount
- value to be set
-
deepCopy
factory method to create a deep copy of TypedMoneyDraft- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
centPrecisionBuilder
builder for centPrecision subtype- Returns:
- builder
-
highPrecisionBuilder
builder for highPrecision subtype- Returns:
- builder
-
withTypedMoneyDraft
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
createMoneyOperator
default javax.money.MonetaryOperator createMoneyOperator()- Specified by:
createMoneyOperator
in interfaceMoney
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-