Class TypedMoneyImpl

java.lang.Object
com.commercetools.api.models.common.TypedMoneyImpl
All Implemented Interfaces:
MonetaryAmountConvertable, Money, TypedMoney, io.vrap.rmf.base.client.ModelBase, Comparable<javax.money.MonetaryAmount>, javax.money.CurrencySupplier, javax.money.MonetaryAmount, javax.money.NumberSupplier

public class TypedMoneyImpl extends Object implements TypedMoney, io.vrap.rmf.base.client.ModelBase

Base polymorphic read-only Money type which is stored in cent precision or high precision. The actual type is determined by the type field.

  • Constructor Details

  • Method Details

    • 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).
      Specified by:
      getCentAmount in interface Money
      Returns:
      centAmount
    • getCurrencyCode

      Currency code compliant to ISO 4217.

      Specified by:
      getCurrencyCode in interface Money
      Returns:
      currencyCode
    • getType

      public MoneyType getType()

      MoneyType supports two different values, one for amounts in cent precision and another one for sub-cent amounts up to 20 fraction digits.

      Specified by:
      getType in interface TypedMoney
      Returns:
      type
    • getFractionDigits

      Number of digits after the decimal separator:

      • Equal to the default number of fraction digits for a currency in CentPrecisionMoney.
      • Greater than the default number of fraction digits for a currency in HighPrecisionMoney.
      Specified by:
      getFractionDigits in interface TypedMoney
      Returns:
      fractionDigits
    • setCentAmount

      public void setCentAmount(Long centAmount)
      Specified by:
      setCentAmount in interface Money
    • setCurrencyCode

      public void setCurrencyCode(String currencyCode)
      Specified by:
      setCurrencyCode in interface Money
    • setFractionDigits

      public void setFractionDigits(Integer fractionDigits)
      Description copied from interface: TypedMoney

      Number of digits after the decimal separator:

      • Equal to the default number of fraction digits for a currency in CentPrecisionMoney.
      • Greater than the default number of fraction digits for a currency in HighPrecisionMoney.
      Specified by:
      setFractionDigits in interface TypedMoney
      Parameters:
      fractionDigits - value to be set
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object