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()
      Returns:
      type
    • getFractionDigits

      Integer getFractionDigits()
      Returns:
      fractionDigits
    • getCentAmount

      @NotNull @NotNull Long getCentAmount()
      Returns:
      centAmount
    • getCurrencyCode

      @NotNull @NotNull String getCurrencyCode()

      The currency code compliant to ISO 4217.

      Returns:
      currencyCode
    • setFractionDigits

      void setFractionDigits(Integer fractionDigits)
      set fractionDigits
      Parameters:
      fractionDigits - value to be set
    • setCentAmount

      void setCentAmount(Long centAmount)
      set centAmount
      Parameters:
      centAmount - value to be set
    • setCurrencyCode

      void setCurrencyCode(String currencyCode)

      The currency code compliant to ISO 4217.

      Parameters:
      currencyCode - value to be set
    • 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