Class MoneyBuilder
java.lang.Object
com.commercetools.history.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()
.currencyCode("{currencyCode}")
.centAmount(1)
.fractionDigits(1)
.type(MoneyType.CENT_PRECISION)
.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(Integer centAmount) set the value to the centAmountcurrencyCode(String currencyCode) Currency code compliant to ISO 4217.fractionDigits(Integer fractionDigits) set the value to the fractionDigitsvalue of centAmount}Currency code compliant to ISO 4217.value of fractionDigits}getType()value of type}static MoneyBuilderof()factory method for an instance of MoneyBuilderstatic MoneyBuildercreate builder for Money instanceset the value to the type
-
Constructor Details
-
MoneyBuilder
public MoneyBuilder()
-
-
Method Details
-
currencyCode
Currency code compliant to ISO 4217.
- Parameters:
currencyCode- value to be set- Returns:
- Builder
-
centAmount
set the value to the centAmount- Parameters:
centAmount- value to be set- Returns:
- Builder
-
fractionDigits
set the value to the fractionDigits- Parameters:
fractionDigits- value to be set- Returns:
- Builder
-
type
set the value to the type- Parameters:
type- value to be set- Returns:
- Builder
-
getCurrencyCode
Currency code compliant to ISO 4217.
- Returns:
- currencyCode
-
getCentAmount
value of centAmount}- Returns:
- centAmount
-
getFractionDigits
value of fractionDigits}- Returns:
- fractionDigits
-
getType
value of type}- Returns:
- type
-
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
-