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 be Money or Percentage) 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 via setApplicableUnits(int). Also the charge can be marked to be ignored (see AbstractCharge.setDisabled(boolean)).
  • Constructor Details

    • 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 amount
      perUnit - if true the 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 amount
      perUnit - if true the charge is being applied for each unit of the line item, otherwise just once per line
      applicableForUnits - if applying per unit this limits the number of units that this charge must be applied to
  • Method Details

    • 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 by getApplicableUnits().
      See Also:
    • getApplicableUnits

      public int getApplicableUnits()
      In case this charge applies per unit this method returns the maximum number of units to apply to.
      See Also:
    • 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:
    • toString

      public String toString()
      Overrides:
      toString in class Object