Interface HighPrecisionMoney

All Superinterfaces:
Comparable<javax.money.MonetaryAmount>, javax.money.CurrencySupplier, javax.money.MonetaryAmount, MonetaryAmountConvertable, Money, javax.money.NumberSupplier, TypedMoney

public interface HighPrecisionMoney extends TypedMoney

Money object that stores an amount of a fraction of the smallest indivisible unit of the specified currency.


Example to create an instance using the builder pattern

     HighPrecisionMoney highPrecisionMoney = HighPrecisionMoney.builder()
             .centAmount(0.3)
             .currencyCode("{currencyCode}")
             .fractionDigits(0.3)
             .preciseAmount(0.3)
             .build()
 
  • Field Details

  • Method Details

    • getPreciseAmount

      @NotNull @NotNull Long getPreciseAmount()

      Amount in 1 / (10 ^ fractionDigits) of a currency.

      Returns:
      preciseAmount
    • getFractionDigits

      @NotNull @NotNull Integer getFractionDigits()

      Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.

      Specified by:
      getFractionDigits in interface TypedMoney
      Returns:
      fractionDigits
    • setPreciseAmount

      void setPreciseAmount(Long preciseAmount)

      Amount in 1 / (10 ^ fractionDigits) of a currency.

      Parameters:
      preciseAmount - value to be set
    • setFractionDigits

      void setFractionDigits(Integer fractionDigits)

      Number of digits after the decimal separator, greater than the default number of fraction digits for a currency.

      Specified by:
      setFractionDigits in interface TypedMoney
      Parameters:
      fractionDigits - value to be set
    • of

      static HighPrecisionMoney of()
      factory method
      Returns:
      instance of HighPrecisionMoney
    • of

      static HighPrecisionMoney of(HighPrecisionMoney template)
      factory method to create a shallow copy HighPrecisionMoney
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      factory method to create a deep copy of HighPrecisionMoney
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static HighPrecisionMoneyBuilder builder()
      builder factory method for HighPrecisionMoney
      Returns:
      builder
    • builder

      static HighPrecisionMoneyBuilder builder(HighPrecisionMoney template)
      create builder for HighPrecisionMoney instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withHighPrecisionMoney

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

      static HighPrecisionMoney of(javax.money.MonetaryAmount monetaryAmount, int fractionDigits)
    • toDraft

      default HighPrecisionMoneyDraft toDraft()
      Specified by:
      toDraft in interface Money
    • createMoneyOperator

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

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