Class HighPrecisionMoneyDraftBuilder

java.lang.Object
com.commercetools.api.models.common.HighPrecisionMoneyDraftBuilder
All Implemented Interfaces:
Builder<HighPrecisionMoneyDraft>

public class HighPrecisionMoneyDraftBuilder extends Object implements 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

    • HighPrecisionMoneyDraftBuilder

      public HighPrecisionMoneyDraftBuilder()
  • Method Details

    • centAmount

      public HighPrecisionMoneyDraftBuilder centAmount(@Nullable Long 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

      public HighPrecisionMoneyDraftBuilder currencyCode(String currencyCode)

      Currency code compliant to ISO 4217.

      Parameters:
      currencyCode - value to be set
      Returns:
      Builder
    • fractionDigits

      public HighPrecisionMoneyDraftBuilder fractionDigits(Integer 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

      public HighPrecisionMoneyDraftBuilder preciseAmount(Long preciseAmount)

      Amount in 1 / (10 ^ fractionDigits) of a currency.

      Parameters:
      preciseAmount - value to be set
      Returns:
      Builder
    • getCentAmount

      @Nullable public Long 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

      public String getCurrencyCode()

      Currency code compliant to ISO 4217.

      Returns:
      currencyCode
    • getFractionDigits

      public Integer 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

      public Long getPreciseAmount()

      Amount in 1 / (10 ^ fractionDigits) of a currency.

      Returns:
      preciseAmount
    • build

      public HighPrecisionMoneyDraft build()
      builds HighPrecisionMoneyDraft with checking for non-null required values
      Specified by:
      build in interface Builder<HighPrecisionMoneyDraft>
      Returns:
      HighPrecisionMoneyDraft
    • buildUnchecked

      public HighPrecisionMoneyDraft buildUnchecked()
      builds HighPrecisionMoneyDraft without checking for non-null required values
      Returns:
      HighPrecisionMoneyDraft
    • of

      public static HighPrecisionMoneyDraftBuilder 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