Class MoneyBuilder

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

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

     Money money = Money.builder()
             .centAmount(0.3)
             .currencyCode("{currencyCode}")
             .build()
 
  • Constructor Details

    • MoneyBuilder

      public MoneyBuilder()
  • Method Details

    • centAmount

      public MoneyBuilder 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 - the value to be set
      Returns:
      Builder
    • currencyCode

      public MoneyBuilder currencyCode(String currencyCode)

      Currency code compliant to ISO 4217.

      Parameters:
      currencyCode - the value to be set
      Returns:
      Builder
    • getCentAmount

      public Long getCentAmount()
    • getCurrencyCode

      public String getCurrencyCode()
    • build

      public Money build()
      Description copied from interface: Builder
      build an instance of the generic type
      Specified by:
      build in interface Builder<Money>
      Returns:
      build instance
    • buildUnchecked

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

      public static MoneyBuilder of()
    • of

      public static MoneyBuilder of(Money template)
    • centPrecision

      public CentPrecisionMoneyBuilder centPrecision(javax.money.MonetaryAmount monetaryAmount)
    • centPrecisionDraft

      public CentPrecisionMoneyDraftBuilder centPrecisionDraft(javax.money.MonetaryAmount monetaryAmount)
    • highPrecision

      public HighPrecisionMoneyBuilder highPrecision(javax.money.MonetaryAmount monetaryAmount, int fractionDigits)
    • highPrecisionDraft

      public HighPrecisionMoneyDraftBuilder highPrecisionDraft(javax.money.MonetaryAmount monetaryAmount, int fractionDigits)