Class TypedMoneyImpl
java.lang.Object
com.commercetools.api.models.common.TypedMoneyImpl
- All Implemented Interfaces:
MonetaryAmountConvertable
,Money
,TypedMoney
,io.vrap.rmf.base.client.ModelBase
,Comparable<javax.money.MonetaryAmount>
,javax.money.CurrencySupplier
,javax.money.MonetaryAmount
,javax.money.NumberSupplier
Base polymorphic read-only money type that stores currency in cent precision or high precision, that is in sub-cents.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.vrap.rmf.base.client.ModelBase
io.vrap.rmf.base.client.ModelBase.FilteredRecursiveToStringStyle
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Amount in the smallest indivisible unit of a currency, such as:Currency code compliant to ISO 4217.Number of digits after the decimal separator.getType()
Type of money used.int
hashCode()
void
setCentAmount
(Long centAmount) void
setCurrencyCode
(String currencyCode) void
setFractionDigits
(Integer fractionDigits) Number of digits after the decimal separator.Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.vrap.rmf.base.client.ModelBase
reflectionString, reflectionString
Methods 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, getFactory, getNumber, isEqualTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, multiply, multiply, multiply, negate, plus, query, remainder, remainder, remainder, scaleByPowerOfTen, signum, stripTrailingZeros, subtract, toDraft, with, withMoney
Methods inherited from interface com.commercetools.api.models.common.TypedMoney
createMoneyOperator, withTypedMoney
-
Constructor Details
-
TypedMoneyImpl
public TypedMoneyImpl()create empty instance
-
-
Method Details
-
getCentAmount
Amount in the smallest indivisible unit of a currency, such as:
- Cents for EUR and USD, pence for GBP, or centime for CHF (5 CHF is specified as
500
). - The value in the major unit for currencies without minor units, like JPY (5 JPY is specified as
5
).
- Specified by:
getCentAmount
in interfaceMoney
- Returns:
- centAmount
- Cents for EUR and USD, pence for GBP, or centime for CHF (5 CHF is specified as
-
getCurrencyCode
Currency code compliant to ISO 4217.
- Specified by:
getCurrencyCode
in interfaceMoney
- Returns:
- currencyCode
-
getType
Type of money used.
- Specified by:
getType
in interfaceTypedMoney
- Returns:
- type
-
getFractionDigits
Number of digits after the decimal separator.
- For CentPrecisionMoney, it is equal to the default number of fraction digits for a currency.
- For HighPrecisionMoney, it is greater than the default number of fraction digits for a currency.
- Specified by:
getFractionDigits
in interfaceTypedMoney
- Returns:
- fractionDigits
-
setCentAmount
- Specified by:
setCentAmount
in interfaceMoney
-
setCurrencyCode
- Specified by:
setCurrencyCode
in interfaceMoney
-
setFractionDigits
Description copied from interface:TypedMoney
Number of digits after the decimal separator.
- For CentPrecisionMoney, it is equal to the default number of fraction digits for a currency.
- For HighPrecisionMoney, it is greater than the default number of fraction digits for a currency.
- Specified by:
setFractionDigits
in interfaceTypedMoney
- Parameters:
fractionDigits
- value to be set
-
equals
-
hashCode
-