Class DefaultRoundingStrategy
- java.lang.Object
-
- de.hybris.order.calculation.strategies.impl.DefaultRoundingStrategy
-
- All Implemented Interfaces:
RoundingStrategy
- Direct Known Subclasses:
DefaultTaxRoundingStrategy
public class DefaultRoundingStrategy extends java.lang.Object implements RoundingStrategy
-
-
Constructor Summary
Constructors Constructor Description DefaultRoundingStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MoneycreateMoney(java.math.BigDecimal amount, Currency curr)Moneydivide(Money price, java.math.BigDecimal divisor)Divide price by factorMoneygetPercentValue(Money price, Percentage percent)Returns for the givenPercentageamount the calculated amount inMoney.Moneymultiply(Money price, java.math.BigDecimal multiplicant)Multiply the given money by given factor.MoneyroundToMoney(java.math.BigDecimal amount, Currency currency)Creates aMoneyobject based on the given BigDecimal amount.
-
-
-
Method Detail
-
divide
public Money divide(Money price, java.math.BigDecimal divisor)
Description copied from interface:RoundingStrategyDivide price by factor- Specified by:
dividein interfaceRoundingStrategy- Parameters:
price- to divide fordivisor- to divide by- Returns:
- result of dividing
-
multiply
public Money multiply(Money price, java.math.BigDecimal multiplicant)
Description copied from interface:RoundingStrategyMultiply the given money by given factor. The returned Money is the nearest result (rounded up/down) to the calculation.- Specified by:
multiplyin interfaceRoundingStrategy- Parameters:
price- to multiple formultiplicant- to multiple by- Returns:
- result of multiplying
-
getPercentValue
public Money getPercentValue(Money price, Percentage percent)
Description copied from interface:RoundingStrategyReturns for the givenPercentageamount the calculated amount inMoney. E.g. 25% of 10.01Euro result in 2.50euro- Specified by:
getPercentValuein interfaceRoundingStrategy- Parameters:
price- the pricepercent- the percentage of the price to take.- Returns:
- A Money object representing a percentage of the price.
-
roundToMoney
public Money roundToMoney(java.math.BigDecimal amount, Currency currency)
Description copied from interface:RoundingStrategyCreates aMoneyobject based on the given BigDecimal amount. Based on the implementation the amount is round up/down to fit into the money.- Specified by:
roundToMoneyin interfaceRoundingStrategy- Parameters:
amount- the amount to be convertedcurrency- based on the currency digits the amount is round up/down- Returns:
- the neares Money object for the given amount.
-
-