Interface RoundingStrategy

All Known Implementing Classes:
DefaultRoundingStrategy, DefaultTaxRoundingStrategy

public interface RoundingStrategy
  • Method Details

    • divide

      Money divide(Money money, BigDecimal factor)
      Divide price by factor
      Parameters:
      money - to divide for
      factor - to divide by
      Returns:
      result of dividing
    • multiply

      Money multiply(Money money, BigDecimal factor)
      Multiply the given money by given factor. The returned Money is the nearest result (rounded up/down) to the calculation.
      Parameters:
      money - to multiple for
      factor - to multiple by
      Returns:
      result of multiplying
    • getPercentValue

      Money getPercentValue(Money price, Percentage percent)
      Returns for the given Percentage amount the calculated amount in Money. E.g. 25% of 10.01Euro result in 2.50euro
      Parameters:
      price - the price
      percent - the percentage of the price to take.
      Returns:
      A Money object representing a percentage of the price.
    • roundToMoney

      Money roundToMoney(BigDecimal amount, Currency currency)
      Creates a Money object based on the given BigDecimal amount. Based on the implementation the amount is round up/down to fit into the money.
      Parameters:
      amount - the amount to be converted
      currency - based on the currency digits the amount is round up/down
      Returns:
      the neares Money object for the given amount.