Interface Money
- All Superinterfaces:
Comparable<javax.money.MonetaryAmount>
,javax.money.CurrencySupplier
,javax.money.MonetaryAmount
,MonetaryAmountConvertable
,javax.money.NumberSupplier
- All Known Subinterfaces:
CentPrecisionMoney
,CentPrecisionMoneyDraft
,HighPrecisionMoney
,HighPrecisionMoneyDraft
,TypedMoney
,TypedMoneyDraft
Draft type that stores amounts in cent precision for the specified currency.
For storing money values in fractions of the minor unit in a currency, use HighPrecisionMoneyDraft instead.
Example to create an instance using the builder pattern
Money money = Money.builder()
.centAmount(0.3)
.currencyCode("{currencyCode}")
.build()
-
Method Summary
Modifier and TypeMethodDescriptiondefault javax.money.MonetaryAmount
abs()
default javax.money.MonetaryAmount
add
(javax.money.MonetaryAmount augend) static MoneyBuilder
builder()
static MoneyBuilder
default int
compareTo
(javax.money.MonetaryAmount o) default javax.money.MonetaryOperator
static Money
default javax.money.MonetaryAmount
divide
(double divisor) default javax.money.MonetaryAmount
divide
(long divisor) default javax.money.MonetaryAmount
default javax.money.MonetaryAmount[]
divideAndRemainder
(double divisor) default javax.money.MonetaryAmount[]
divideAndRemainder
(long divisor) default javax.money.MonetaryAmount[]
divideAndRemainder
(Number divisor) default javax.money.MonetaryAmount
divideToIntegralValue
(double divisor) default javax.money.MonetaryAmount
divideToIntegralValue
(long divisor) default javax.money.MonetaryAmount
divideToIntegralValue
(Number divisor) static CentPrecisionMoneyDraft
draftOf
(javax.money.MonetaryAmount monetaryAmount) static HighPrecisionMoneyDraft
draftOf
(javax.money.MonetaryAmount monetaryAmount, int fractionDigits) @NotNull Long
Amount in the smallest indivisible unit of a currency, such as:default javax.money.MonetaryContext
default javax.money.CurrencyUnit
@NotNull String
Currency code compliant to ISO 4217.default javax.money.MonetaryAmountFactory<? extends javax.money.MonetaryAmount>
default javax.money.NumberValue
default boolean
isEqualTo
(javax.money.MonetaryAmount amount) default boolean
isGreaterThan
(javax.money.MonetaryAmount amount) default boolean
isGreaterThanOrEqualTo
(javax.money.MonetaryAmount amount) default boolean
isLessThan
(javax.money.MonetaryAmount amount) default boolean
isLessThanOrEqualTo
(javax.money.MonetaryAmount amount) default javax.money.MonetaryAmount
multiply
(double multiplicand) default javax.money.MonetaryAmount
multiply
(long multiplicand) default javax.money.MonetaryAmount
default javax.money.MonetaryAmount
negate()
static Money
of()
static Money
static CentPrecisionMoney
of
(javax.money.MonetaryAmount monetaryAmount) static HighPrecisionMoney
of
(javax.money.MonetaryAmount monetaryAmount, int fractionDigits) default javax.money.MonetaryAmount
plus()
default <R> R
query
(javax.money.MonetaryQuery<R> query) default javax.money.MonetaryAmount
remainder
(double divisor) default javax.money.MonetaryAmount
remainder
(long divisor) default javax.money.MonetaryAmount
default javax.money.MonetaryAmount
scaleByPowerOfTen
(int power) void
setCentAmount
(Long centAmount) void
setCurrencyCode
(String currencyCode) default int
signum()
default javax.money.MonetaryAmount
default javax.money.MonetaryAmount
subtract
(javax.money.MonetaryAmount subtrahend) default TypedMoneyDraft
toDraft()
static com.fasterxml.jackson.core.type.TypeReference<Money>
default javax.money.MonetaryAmount
with
(javax.money.MonetaryOperator operator) default <T> T
Methods inherited from interface javax.money.MonetaryAmount
isNegative, isNegativeOrZero, isPositive, isPositiveOrZero, isZero
Methods inherited from interface com.commercetools.api.models.common.MonetaryAmountConvertable
toMonetaryAmount
-
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
).
- 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.
- Returns:
- currencyCode
-
setCentAmount
-
setCurrencyCode
-
of
-
of
-
of
-
of
-
draftOf
-
draftOf
static HighPrecisionMoneyDraft draftOf(javax.money.MonetaryAmount monetaryAmount, int fractionDigits) -
deepCopy
-
builder
-
builder
-
withMoney
- Specified by:
withMoney
in interfaceMonetaryAmountConvertable
-
toDraft
-
typeReference
-
createMoneyOperator
default javax.money.MonetaryOperator createMoneyOperator() -
getContext
default javax.money.MonetaryContext getContext()- Specified by:
getContext
in interfacejavax.money.MonetaryAmount
-
getFactory
default javax.money.MonetaryAmountFactory<? extends javax.money.MonetaryAmount> getFactory()- Specified by:
getFactory
in interfacejavax.money.MonetaryAmount
-
isGreaterThan
default boolean isGreaterThan(javax.money.MonetaryAmount amount) - Specified by:
isGreaterThan
in interfacejavax.money.MonetaryAmount
-
isGreaterThanOrEqualTo
default boolean isGreaterThanOrEqualTo(javax.money.MonetaryAmount amount) - Specified by:
isGreaterThanOrEqualTo
in interfacejavax.money.MonetaryAmount
-
isLessThan
default boolean isLessThan(javax.money.MonetaryAmount amount) - Specified by:
isLessThan
in interfacejavax.money.MonetaryAmount
-
isLessThanOrEqualTo
default boolean isLessThanOrEqualTo(javax.money.MonetaryAmount amount) - Specified by:
isLessThanOrEqualTo
in interfacejavax.money.MonetaryAmount
-
isEqualTo
default boolean isEqualTo(javax.money.MonetaryAmount amount) - Specified by:
isEqualTo
in interfacejavax.money.MonetaryAmount
-
signum
default int signum()- Specified by:
signum
in interfacejavax.money.MonetaryAmount
-
add
default javax.money.MonetaryAmount add(javax.money.MonetaryAmount augend) - Specified by:
add
in interfacejavax.money.MonetaryAmount
-
subtract
default javax.money.MonetaryAmount subtract(javax.money.MonetaryAmount subtrahend) - Specified by:
subtract
in interfacejavax.money.MonetaryAmount
-
multiply
default javax.money.MonetaryAmount multiply(long multiplicand) - Specified by:
multiply
in interfacejavax.money.MonetaryAmount
-
multiply
default javax.money.MonetaryAmount multiply(double multiplicand) - Specified by:
multiply
in interfacejavax.money.MonetaryAmount
-
multiply
- Specified by:
multiply
in interfacejavax.money.MonetaryAmount
-
divide
default javax.money.MonetaryAmount divide(long divisor) - Specified by:
divide
in interfacejavax.money.MonetaryAmount
-
divide
default javax.money.MonetaryAmount divide(double divisor) - Specified by:
divide
in interfacejavax.money.MonetaryAmount
-
divide
- Specified by:
divide
in interfacejavax.money.MonetaryAmount
-
remainder
default javax.money.MonetaryAmount remainder(long divisor) - Specified by:
remainder
in interfacejavax.money.MonetaryAmount
-
remainder
default javax.money.MonetaryAmount remainder(double divisor) - Specified by:
remainder
in interfacejavax.money.MonetaryAmount
-
remainder
- Specified by:
remainder
in interfacejavax.money.MonetaryAmount
-
divideAndRemainder
default javax.money.MonetaryAmount[] divideAndRemainder(long divisor) - Specified by:
divideAndRemainder
in interfacejavax.money.MonetaryAmount
-
divideAndRemainder
default javax.money.MonetaryAmount[] divideAndRemainder(double divisor) - Specified by:
divideAndRemainder
in interfacejavax.money.MonetaryAmount
-
divideAndRemainder
- Specified by:
divideAndRemainder
in interfacejavax.money.MonetaryAmount
-
divideToIntegralValue
default javax.money.MonetaryAmount divideToIntegralValue(long divisor) - Specified by:
divideToIntegralValue
in interfacejavax.money.MonetaryAmount
-
divideToIntegralValue
default javax.money.MonetaryAmount divideToIntegralValue(double divisor) - Specified by:
divideToIntegralValue
in interfacejavax.money.MonetaryAmount
-
divideToIntegralValue
- Specified by:
divideToIntegralValue
in interfacejavax.money.MonetaryAmount
-
scaleByPowerOfTen
default javax.money.MonetaryAmount scaleByPowerOfTen(int power) - Specified by:
scaleByPowerOfTen
in interfacejavax.money.MonetaryAmount
-
abs
default javax.money.MonetaryAmount abs()- Specified by:
abs
in interfacejavax.money.MonetaryAmount
-
negate
default javax.money.MonetaryAmount negate()- Specified by:
negate
in interfacejavax.money.MonetaryAmount
-
plus
default javax.money.MonetaryAmount plus()- Specified by:
plus
in interfacejavax.money.MonetaryAmount
-
stripTrailingZeros
default javax.money.MonetaryAmount stripTrailingZeros()- Specified by:
stripTrailingZeros
in interfacejavax.money.MonetaryAmount
-
compareTo
default int compareTo(javax.money.MonetaryAmount o) - Specified by:
compareTo
in interfaceComparable<javax.money.MonetaryAmount>
-
getCurrency
default javax.money.CurrencyUnit getCurrency()- Specified by:
getCurrency
in interfacejavax.money.CurrencySupplier
-
getNumber
default javax.money.NumberValue getNumber()- Specified by:
getNumber
in interfacejavax.money.NumberSupplier
-
query
default <R> R query(javax.money.MonetaryQuery<R> query) - Specified by:
query
in interfacejavax.money.MonetaryAmount
-
with
default javax.money.MonetaryAmount with(javax.money.MonetaryOperator operator) - Specified by:
with
in interfacejavax.money.MonetaryAmount
-