Class MoneyBuilder
java.lang.Object
com.commercetools.api.models.common.MoneyBuilder
MoneyBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
Money money = Money.builder()
.centAmount(0.3)
.currencyCode("{currencyCode}")
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
build an instance of the generic typebuilds Money without checking for non-null required valuescentAmount
(Long centAmount) Amount in the smallest indivisible unit of a currency, such as:centPrecision
(javax.money.MonetaryAmount monetaryAmount) centPrecisionDraft
(javax.money.MonetaryAmount monetaryAmount) currencyCode
(String currencyCode) Currency code compliant to ISO 4217.highPrecision
(javax.money.MonetaryAmount monetaryAmount, int fractionDigits) highPrecisionDraft
(javax.money.MonetaryAmount monetaryAmount, int fractionDigits) static MoneyBuilder
of()
static MoneyBuilder
-
Constructor Details
-
MoneyBuilder
public MoneyBuilder()
-
-
Method Details
-
centAmount
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
).
- Parameters:
centAmount
- the value to be set- Returns:
- Builder
- Cents for EUR and USD, pence for GBP, or centime for CHF (5 CHF is specified as
-
currencyCode
Currency code compliant to ISO 4217.
- Parameters:
currencyCode
- the value to be set- Returns:
- Builder
-
getCentAmount
-
getCurrencyCode
-
build
Description copied from interface:Builder
build an instance of the generic type -
buildUnchecked
builds Money without checking for non-null required values- Returns:
- Money
-
of
-
of
-
centPrecision
-
centPrecisionDraft
-
highPrecision
public HighPrecisionMoneyBuilder highPrecision(javax.money.MonetaryAmount monetaryAmount, int fractionDigits) -
highPrecisionDraft
public HighPrecisionMoneyDraftBuilder highPrecisionDraft(javax.money.MonetaryAmount monetaryAmount, int fractionDigits)
-