Class DefaultRoundingStrategy

java.lang.Object
de.hybris.order.calculation.strategies.impl.DefaultRoundingStrategy
All Implemented Interfaces:
RoundingStrategy
Direct Known Subclasses:
DefaultTaxRoundingStrategy

public class DefaultRoundingStrategy extends Object implements RoundingStrategy
  • Constructor Details

    • DefaultRoundingStrategy

      public DefaultRoundingStrategy()
  • Method Details

    • divide

      public Money divide(Money price, BigDecimal divisor)
      Description copied from interface: RoundingStrategy
      Divide price by factor
      Specified by:
      divide in interface RoundingStrategy
      Parameters:
      price - to divide for
      divisor - to divide by
      Returns:
      result of dividing
    • multiply

      public Money multiply(Money price, BigDecimal multiplicant)
      Description copied from interface: RoundingStrategy
      Multiply the given money by given factor. The returned Money is the nearest result (rounded up/down) to the calculation.
      Specified by:
      multiply in interface RoundingStrategy
      Parameters:
      price - to multiple for
      multiplicant - to multiple by
      Returns:
      result of multiplying
    • getPercentValue

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

      public Money roundToMoney(BigDecimal amount, Currency currency)
      Description copied from interface: RoundingStrategy
      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.
      Specified by:
      roundToMoney in interface RoundingStrategy
      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.
    • createMoney

      protected Money createMoney(BigDecimal amount, Currency curr)