Interface TypedMoney

All Known Subinterfaces:
HighPrecisionMoney, Money

public interface TypedMoney
TypedMoney
Example to create a subtype instance using the builder pattern

     TypedMoney typedMoney = TypedMoney.highPrecisionBuilder()
             centAmount(0.3)
             currencyCode("{currencyCode}")
             preciseAmount(0.3)
             .build()
 
  • Method Details

    • getType

      @NotNull @NotNull MoneyType getType()

      The type of money. The centPrecision type is used for currencies with minor units, such as EUR and USD. The highPrecision type is used for currencies without minor units, such as JPY.

      Returns:
      type
    • getFractionDigits

      Integer getFractionDigits()

      The number of fraction digits of the money value. This is used to determine how many digits are after the decimal point. For example, for EUR and USD, this is 2, and for JPY, this is 0.

      Returns:
      fractionDigits
    • getCentAmount

      @NotNull @NotNull 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

      @NotNull @NotNull String getCurrencyCode()

      The currency code compliant to ISO 4217.

      Returns:
      currencyCode
    • setFractionDigits

      void setFractionDigits(Integer fractionDigits)

      The number of fraction digits of the money value. This is used to determine how many digits are after the decimal point. For example, for EUR and USD, this is 2, and for JPY, this is 0.

      Parameters:
      fractionDigits - value to be set
    • setCentAmount

      void setCentAmount(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
    • setCurrencyCode

      void setCurrencyCode(String currencyCode)

      The currency code compliant to ISO 4217.

      Parameters:
      currencyCode - value to be set
    • copyDeep

      TypedMoney copyDeep()
    • deepCopy

      @Nullable static TypedMoney deepCopy(@Nullable TypedMoney template)
      factory method to create a deep copy of TypedMoney
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • highPrecisionBuilder

      static HighPrecisionMoneyBuilder highPrecisionBuilder()
      builder for highPrecision subtype
      Returns:
      builder
    • centPrecisionBuilder

      static MoneyBuilder centPrecisionBuilder()
      builder for centPrecision subtype
      Returns:
      builder
    • withTypedMoney

      default <T> T withTypedMoney(Function<TypedMoney,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<TypedMoney> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference