Class HighPrecisionMoneyDraftBuilder
- All Implemented Interfaces:
Builder<HighPrecisionMoneyDraft>
Example to create an instance using the builder pattern
HighPrecisionMoneyDraft highPrecisionMoneyDraft = HighPrecisionMoneyDraft.builder()
.currencyCode("{currencyCode}")
.fractionDigits(0.3)
.preciseAmount(0.3)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds HighPrecisionMoneyDraft with checking for non-null required valuesbuilds HighPrecisionMoneyDraft without checking for non-null required valuescentAmount
(Long centAmount) Amount in the smallest indivisible unit of a currency.currencyCode
(String currencyCode) Currency code compliant to ISO 4217.fractionDigits
(Integer fractionDigits) Number of fraction digits for a specified high precision money.Amount in the smallest indivisible unit of a currency.Currency code compliant to ISO 4217.Number of fraction digits for a specified high precision money.Amount in 1 / (10 ^fractionDigits
) of a currency.of()
factory method for an instance of HighPrecisionMoneyDraftBuilderof
(HighPrecisionMoneyDraft template) create builder for HighPrecisionMoneyDraft instancepreciseAmount
(Long preciseAmount) Amount in 1 / (10 ^fractionDigits
) of a currency.
-
Constructor Details
-
HighPrecisionMoneyDraftBuilder
public HighPrecisionMoneyDraftBuilder()
-
-
Method Details
-
centAmount
Amount in the smallest indivisible unit of a currency. This field is optional for high precision. If provided, it is checked for validity. Example:
A Price of 1.015 USD can be rounded either to 1.01 USD or 1.02 USD. If it lies outside of this range, an error message stating that centAmount must be rounded correctly will be returned.
If
centAmount
is not provided, the API calculates the value automatically using the default rounding mode half even.- Parameters:
centAmount
- value to be set- Returns:
- Builder
-
currencyCode
Currency code compliant to ISO 4217.
- Parameters:
currencyCode
- value to be set- Returns:
- Builder
-
fractionDigits
Number of fraction digits for a specified high precision money. It must be greater than the default number of fraction digits for the specified 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. This field is optional for high precision. If provided, it is checked for validity. Example:
A Price of 1.015 USD can be rounded either to 1.01 USD or 1.02 USD. If it lies outside of this range, an error message stating that centAmount must be rounded correctly will be returned.
If
centAmount
is not provided, the API calculates the value automatically using the default rounding mode half even.- Returns:
- centAmount
-
getCurrencyCode
Currency code compliant to ISO 4217.
- Returns:
- currencyCode
-
getFractionDigits
Number of fraction digits for a specified high precision money. It must be greater than the default number of fraction digits for the specified currency.
- Returns:
- fractionDigits
-
getPreciseAmount
Amount in 1 / (10 ^
fractionDigits
) of a currency.- Returns:
- preciseAmount
-
build
builds HighPrecisionMoneyDraft with checking for non-null required values- Specified by:
build
in interfaceBuilder<HighPrecisionMoneyDraft>
- Returns:
- HighPrecisionMoneyDraft
-
buildUnchecked
builds HighPrecisionMoneyDraft without checking for non-null required values- Returns:
- HighPrecisionMoneyDraft
-
of
factory method for an instance of HighPrecisionMoneyDraftBuilder- Returns:
- builder
-
of
create builder for HighPrecisionMoneyDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-