Interface Money


public interface Money
Money
Example to create an instance using the builder pattern

     Money money = Money.builder()
             .currencyCode("{currencyCode}")
             .centAmount(1)
             .fractionDigits(1)
             .type(MoneyType.CENT_PRECISION)
             .build()
 
  • Method Details

    • getCurrencyCode

      @NotNull @NotNull String getCurrencyCode()

      Currency code compliant to ISO 4217.

      Returns:
      currencyCode
    • getCentAmount

      @NotNull @NotNull Integer getCentAmount()
      Returns:
      centAmount
    • getFractionDigits

      @NotNull @NotNull Integer getFractionDigits()
      Returns:
      fractionDigits
    • getType

      @NotNull @NotNull MoneyType getType()
      Returns:
      type
    • setCurrencyCode

      void setCurrencyCode(String currencyCode)

      Currency code compliant to ISO 4217.

      Parameters:
      currencyCode - value to be set
    • setCentAmount

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

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

      void setType(MoneyType type)
      set type
      Parameters:
      type - value to be set
    • of

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

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

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

      static MoneyBuilder builder()
      builder factory method for Money
      Returns:
      builder
    • builder

      static MoneyBuilder builder(Money template)
      create builder for Money instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withMoney

      default <T> T withMoney(Function<Money,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<Money> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference