Class LineItemDiscount
java.lang.Object
de.hybris.order.calculation.domain.AbstractDiscount
de.hybris.order.calculation.domain.LineItemDiscount
Holds a discounts specific for a
LineItem. The discount holds a amount (can be Money or
Percentage) which can only be set during creation (see AbstractDiscount.getAmount()).
Further it either applies per unit or per line (see isPerUnit()). In case it applies per unit it may be
limited to just a certain amount of units ( see getApplicableUnits() ).-
Constructor Summary
ConstructorsConstructorDescriptionLineItemDiscount(AbstractAmount amount) Creates a new line item discount with the given amount.LineItemDiscount(AbstractAmount amount, boolean perUnit) Creates a new line item discount with given amount.LineItemDiscount(AbstractAmount amount, boolean perUnit, int applicableUnits) Creates a new line item discount with given amount. -
Method Summary
Modifier and TypeMethodDescriptionintIn case this discount applied per unit this returns the maximum number of units that it should apply to.booleanTell whether this discount should be applied for each unit or just once for the whole line.voidsetApplicableUnits(int numberOfUnits) For the case this discount applies per unit this method changes the maximum number of units to apply to.toString()Methods inherited from class de.hybris.order.calculation.domain.AbstractDiscount
getAmount
-
Constructor Details
-
LineItemDiscount
Creates a new line item discount with the given amount. This discount applies per line. -
LineItemDiscount
Creates a new line item discount with given amount. Depending on the given parameters it either applies per unit or per line.- Parameters:
amount- the discount amountperUnit- iftrueit applies per unit, otherwise per line
-
LineItemDiscount
Creates a new line item discount with given amount. Depending on the given parameters it either applies per unit or per line.- Parameters:
amount- the discount amountperUnit- iftrueit applies per unit, otherwise per lineapplicableUnits- when applying per unit this contains the maximum applicable number of units
-
-
Method Details
-
isPerUnit
public boolean isPerUnit()Tell whether this discount should be applied for each unit or just once for the whole line. In case of per unit the number of units are limited bygetApplicableUnits(). -
getApplicableUnits
public int getApplicableUnits()In case this discount applied per unit this returns the maximum number of units that it should apply to. Otherwise this has no effect.- See Also:
-
setApplicableUnits
public void setApplicableUnits(int numberOfUnits) For the case this discount applies per unit this method changes the maximum number of units to apply to.- See Also:
-
toString
-