Class CentPrecisionMoneyBuilder

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

public class CentPrecisionMoneyBuilder extends Object implements Builder<CentPrecisionMoney>
CentPrecisionMoneyBuilder
Example to create an instance using the builder pattern

     CentPrecisionMoney centPrecisionMoney = CentPrecisionMoney.builder()
             .centAmount(0.3)
             .currencyCode("{currencyCode}")
             .fractionDigits(0.3)
             .build()
 
  • Constructor Details

    • CentPrecisionMoneyBuilder

      public CentPrecisionMoneyBuilder()
  • Method Details

    • centAmount

      public CentPrecisionMoneyBuilder centAmount(Long 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).
      Parameters:
      centAmount - value to be set
      Returns:
      Builder
    • currencyCode

      public CentPrecisionMoneyBuilder currencyCode(String currencyCode)

      Currency code compliant to ISO 4217.

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

      public CentPrecisionMoneyBuilder fractionDigits(Integer fractionDigits)

      The number of default fraction digits for the given currency, like 2 for EUR or 0 for JPY.

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

      public Long 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).
      Returns:
      centAmount
    • getCurrencyCode

      public String getCurrencyCode()

      Currency code compliant to ISO 4217.

      Returns:
      currencyCode
    • getFractionDigits

      public Integer getFractionDigits()

      The number of default fraction digits for the given currency, like 2 for EUR or 0 for JPY.

      Returns:
      fractionDigits
    • build

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

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

      public static CentPrecisionMoneyBuilder of()
      factory method for an instance of CentPrecisionMoneyBuilder
      Returns:
      builder
    • of

      public static CentPrecisionMoneyBuilder of(CentPrecisionMoney template)
      create builder for CentPrecisionMoney instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder