Class DefaultRoundingStrategy
java.lang.Object
de.hybris.order.calculation.strategies.impl.DefaultRoundingStrategy
- All Implemented Interfaces:
RoundingStrategy
- Direct Known Subclasses:
DefaultTaxRoundingStrategy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MoneycreateMoney(BigDecimal amount, Currency curr) divide(Money price, BigDecimal divisor) Divide price by factorgetPercentValue(Money price, Percentage percent) Returns for the givenPercentageamount the calculated amount inMoney.multiply(Money price, BigDecimal multiplicant) Multiply the given money by given factor.roundToMoney(BigDecimal amount, Currency currency) Creates aMoneyobject based on the given BigDecimal amount.
-
Constructor Details
-
DefaultRoundingStrategy
public DefaultRoundingStrategy()
-
-
Method Details
-
divide
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
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
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
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.
-
createMoney
-