Class LineItemCharge
- java.lang.Object
-
- de.hybris.order.calculation.domain.AbstractCharge
-
- de.hybris.order.calculation.domain.LineItemCharge
-
public class LineItemCharge extends AbstractCharge
Defines a line item specific charge having a amount (can beMoneyorPercentage) that can only be set during creation. It either applies per unit or per line as specified within constructor. In case it applies per unit the maximum number of units to apply to is being specified viasetApplicableUnits(int). Also the charge can be marked to be ignored (seeAbstractCharge.setDisabled(boolean)).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.order.calculation.domain.AbstractCharge
AbstractCharge.ChargeType
-
-
Constructor Summary
Constructors Constructor Description LineItemCharge(AbstractAmount amount)Creates a new line item charge with a given amount.LineItemCharge(AbstractAmount amount, boolean perUnit)Creates a new line item charge with a specified amount.LineItemCharge(AbstractAmount amount, boolean perUnit, int applicableForUnits)Creates a new line item charge with a specified amount.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetApplicableUnits()In case this charge applies per unit this method returns the maximum number of units to apply to.booleanisPerUnit()Tells whether this charge applies to each unit of the line item or just once per line.voidsetApplicableUnits(int numberOfUnits)For the case this charge applies per unit this method changes the maximum number of units to apply to.java.lang.StringtoString()-
Methods inherited from class de.hybris.order.calculation.domain.AbstractCharge
getAmount, getChargeType, isDisabled, setChargeType, setDisabled
-
-
-
-
Constructor Detail
-
LineItemCharge
public LineItemCharge(AbstractAmount amount)
Creates a new line item charge with a given amount. The charge is applied per line.
-
LineItemCharge
public LineItemCharge(AbstractAmount amount, boolean perUnit)
Creates a new line item charge with a specified amount. It may be either applied per unit or per line.- Parameters:
amount- the charge amountperUnit- iftruethe charge is being applied for each unit of the line item, otherwise just once per line
-
LineItemCharge
public LineItemCharge(AbstractAmount amount, boolean perUnit, int applicableForUnits)
Creates a new line item charge with a specified amount. It may be either applied per unit or per line.- Parameters:
amount- the charge amountperUnit- iftruethe charge is being applied for each unit of the line item, otherwise just once per lineapplicableForUnits- if applying per unit this limits the number of units that this charge must be applied to
-
-
Method Detail
-
isPerUnit
public boolean isPerUnit()
Tells whether this charge applies to each unit of the line item or just once per line. In case it applies per unit the maximum number of units is specified bygetApplicableUnits().- See Also:
getApplicableUnits()
-
getApplicableUnits
public int getApplicableUnits()
In case this charge applies per unit this method returns the maximum number of units to apply to.- See Also:
isPerUnit(),setApplicableUnits(int)
-
setApplicableUnits
public void setApplicableUnits(int numberOfUnits)
For the case this charge applies per unit this method changes the maximum number of units to apply to.- See Also:
isPerUnit(),getApplicableUnits()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-