Class CentPrecisionMoneyBuilder
java.lang.Object
com.commercetools.api.models.common.CentPrecisionMoneyBuilder
- All Implemented Interfaces:
Builder<CentPrecisionMoney>
CentPrecisionMoneyBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
CentPrecisionMoney centPrecisionMoney = CentPrecisionMoney.builder()
.centAmount(0.3)
.currencyCode("{currencyCode}")
.fractionDigits(0.3)
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()builds CentPrecisionMoney with checking for non-null required valuesbuilds CentPrecisionMoney without checking for non-null required valuescentAmount(Long centAmount) Amount in the smallest indivisible unit of a currency, such as:currencyCode(String currencyCode) A currency code compliant with ISO 4217 or a non-standard currency.fractionDigits(Integer fractionDigits) The number of default fraction digits for the given currency, like2for EUR or0for JPY.Amount in the smallest indivisible unit of a currency, such as:A currency code compliant with ISO 4217 or a non-standard currency.The number of default fraction digits for the given currency, like2for EUR or0for JPY.static CentPrecisionMoneyBuilderof()factory method for an instance of CentPrecisionMoneyBuilderstatic CentPrecisionMoneyBuilderof(CentPrecisionMoney template) create builder for CentPrecisionMoney instance
-
Constructor Details
-
CentPrecisionMoneyBuilder
public CentPrecisionMoneyBuilder()
-
-
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).
centAmountis represented as 64-bit integers. If this limit is exceeded, a MoneyOverflow error will be returned.- 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
A currency code compliant with ISO 4217 or a non-standard currency.
- Parameters:
currencyCode- value to be set- Returns:
- Builder
-
fractionDigits
The number of default fraction digits for the given currency, like
2for EUR or0for JPY.- Parameters:
fractionDigits- 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).
centAmountis represented as 64-bit integers. If this limit is exceeded, a MoneyOverflow error will be returned.- Returns:
- centAmount
- Cents for EUR and USD, pence for GBP, or centime for CHF (5 CHF is specified as
-
getCurrencyCode
A currency code compliant with ISO 4217 or a non-standard currency.
- Returns:
- currencyCode
-
getFractionDigits
The number of default fraction digits for the given currency, like
2for EUR or0for JPY.- Returns:
- fractionDigits
-
build
builds CentPrecisionMoney with checking for non-null required values- Specified by:
buildin interfaceBuilder<CentPrecisionMoney>- Returns:
- CentPrecisionMoney
-
buildUnchecked
builds CentPrecisionMoney without checking for non-null required values- Returns:
- CentPrecisionMoney
-
of
factory method for an instance of CentPrecisionMoneyBuilder- Returns:
- builder
-
of
create builder for CentPrecisionMoney instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-