Interface TypedMoneyDraft

All Superinterfaces:
Comparable<javax.money.MonetaryAmount>, javax.money.CurrencySupplier, javax.money.MonetaryAmount, MonetaryAmountConvertable, Money, javax.money.NumberSupplier
All Known Subinterfaces:
CentPrecisionMoneyDraft, HighPrecisionMoneyDraft

public interface TypedMoneyDraft extends Money

Base polymorphic money type containing common fields for Money and HighPrecisionMoneyDraft.

  • To set money in cent precision, use Money.
  • To set money in high precision, use HighPrecisionMoneyDraft.

Example to create a subtype instance using the builder pattern

     TypedMoneyDraft typedMoneyDraft = TypedMoneyDraft.centPrecisionBuilder()
             currencyCode("{currencyCode}")
             .build()
 
  • Method Details

    • getType

      MoneyType getType()

      Determines the type of money used.

      Returns:
      type
    • getFractionDigits

      Integer getFractionDigits()

      Number of fraction digits for a specified money.

      Returns:
      fractionDigits
    • getCentAmount

      Long getCentAmount()

      Amount in the smallest indivisible unit of a currency.

      Specified by:
      getCentAmount in interface Money
      Returns:
      centAmount
    • setFractionDigits

      void setFractionDigits(Integer fractionDigits)

      Number of fraction digits for a specified money.

      Parameters:
      fractionDigits - value to be set
    • setCentAmount

      void setCentAmount(Long centAmount)

      Amount in the smallest indivisible unit of a currency.

      Specified by:
      setCentAmount in interface Money
      Parameters:
      centAmount - value to be set
    • deepCopy

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

      static CentPrecisionMoneyDraftBuilder centPrecisionBuilder()
      builder for centPrecision subtype
      Returns:
      builder
    • highPrecisionBuilder

      static HighPrecisionMoneyDraftBuilder highPrecisionBuilder()
      builder for highPrecision subtype
      Returns:
      builder
    • withTypedMoneyDraft

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

      default javax.money.MonetaryOperator createMoneyOperator()
      Specified by:
      createMoneyOperator in interface Money
    • typeReference

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