Class MoneyBuilder
java.lang.Object
com.commercetools.importapi.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds Money with checking for non-null required valuesbuilds Money without checking for non-null required valuescentAmount
(Long centAmount) Amount in the smallest indivisible unit of a currency, such as:currencyCode
(String currencyCode) The currency code compliant to ISO 4217.fractionDigits
(Integer fractionDigits) The number of fraction digits of the money value.Amount in the smallest indivisible unit of a currency, such as:The currency code compliant to ISO 4217.The number of fraction digits of the money value.static MoneyBuilder
of()
factory method for an instance of MoneyBuilderstatic MoneyBuilder
create builder for Money instance
-
Constructor Details
-
MoneyBuilder
public MoneyBuilder()
-
-
Method Details
-
fractionDigits
The number of fraction digits of the money value. This is used to determine how many digits are after the decimal point. For example, for EUR and USD, this is
2
, and for JPY, this is0
.- Parameters:
fractionDigits
- value to be set- Returns:
- Builder
-
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
- value to be set- Returns:
- Builder
- Cents for EUR and USD, pence for GBP, or centime for CHF (5 CHF is specified as
-
currencyCode
The currency code compliant to ISO 4217.
- Parameters:
currencyCode
- value to be set- Returns:
- Builder
-
getFractionDigits
The number of fraction digits of the money value. This is used to determine how many digits are after the decimal point. For example, for EUR and USD, this is
2
, and for JPY, this is0
.- Returns:
- fractionDigits
-
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
The currency code compliant to ISO 4217.
- Returns:
- currencyCode
-
build
builds Money with checking for non-null required values -
buildUnchecked
builds Money without checking for non-null required values- Returns:
- Money
-
of
factory method for an instance of MoneyBuilder- Returns:
- builder
-
of
create builder for Money instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-