Class HighPrecisionMoneyBuilder
java.lang.Object
com.commercetools.api.models.common.HighPrecisionMoneyBuilder
- All Implemented Interfaces:
Builder<HighPrecisionMoney>
HighPrecisionMoneyBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
HighPrecisionMoney highPrecisionMoney = HighPrecisionMoney.builder()
.centAmount(0.3)
.currencyCode("{currencyCode}")
.fractionDigits(0.3)
.preciseAmount(0.3)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds HighPrecisionMoney with checking for non-null required valuesbuilds HighPrecisionMoney without checking for non-null required valuescentAmount
(Long centAmount) Amount in the smallest indivisible unit of a currency, such as:currencyCode
(String currencyCode) Currency code compliant to ISO 4217.fractionDigits
(Integer fractionDigits) Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.Amount in the smallest indivisible unit of a currency, such as:Currency code compliant to ISO 4217.Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.Amount in 1 / (10 ^fractionDigits
) of a currency.static HighPrecisionMoneyBuilder
of()
factory method for an instance of HighPrecisionMoneyBuilderstatic HighPrecisionMoneyBuilder
of
(HighPrecisionMoney template) create builder for HighPrecisionMoney instancepreciseAmount
(Long preciseAmount) Amount in 1 / (10 ^fractionDigits
) of a currency.
-
Constructor Details
-
HighPrecisionMoneyBuilder
public HighPrecisionMoneyBuilder()
-
-
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
- 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
- value to be set- Returns:
- Builder
-
fractionDigits
Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.
- Parameters:
fractionDigits
- value to be set- Returns:
- Builder
-
preciseAmount
Amount in 1 / (10 ^
fractionDigits
) of a currency.- Parameters:
preciseAmount
- value to be set- Returns:
- Builder
-
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
-
getFractionDigits
Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.
- Returns:
- fractionDigits
-
getPreciseAmount
Amount in 1 / (10 ^
fractionDigits
) of a currency.- Returns:
- preciseAmount
-
build
builds HighPrecisionMoney with checking for non-null required values- Specified by:
build
in interfaceBuilder<HighPrecisionMoney>
- Returns:
- HighPrecisionMoney
-
buildUnchecked
builds HighPrecisionMoney without checking for non-null required values- Returns:
- HighPrecisionMoney
-
of
factory method for an instance of HighPrecisionMoneyBuilder- Returns:
- builder
-
of
create builder for HighPrecisionMoney instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-