Class HighPrecisionMoneyDraftBuilder

java.lang.Object
com.commercetools.api.models.common.HighPrecisionMoneyDraftBuilder
All Implemented Interfaces:
io.vrap.rmf.base.client.Builder<HighPrecisionMoneyDraft>

public class HighPrecisionMoneyDraftBuilder extends Object implements io.vrap.rmf.base.client.Builder<HighPrecisionMoneyDraft>
HighPrecisionMoneyDraftBuilder
Example to create an instance using the builder pattern

     HighPrecisionMoneyDraft highPrecisionMoneyDraft = HighPrecisionMoneyDraft.builder()
             .currencyCode("{currencyCode}")
             .fractionDigits(0.3)
             .preciseAmount(0.3)
             .build()
 
  • Constructor Details

  • 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 interface io.vrap.rmf.base.client.Builder<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