Class LineItemDiscount

java.lang.Object
de.hybris.order.calculation.domain.AbstractDiscount
de.hybris.order.calculation.domain.LineItemDiscount

public class LineItemDiscount extends AbstractDiscount
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 Details

    • LineItemDiscount

      public LineItemDiscount(AbstractAmount amount)
      Creates a new line item discount with the given amount. This discount applies per line.
      See Also:
    • LineItemDiscount

      public LineItemDiscount(AbstractAmount amount, boolean perUnit)
      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 amount
      perUnit - if true it applies per unit, otherwise per line
    • LineItemDiscount

      public LineItemDiscount(AbstractAmount amount, boolean perUnit, int applicableUnits)
      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 amount
      perUnit - if true it applies per unit, otherwise per line
      applicableUnits - 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 by getApplicableUnits().
    • 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

      public String toString()
      Overrides:
      toString in class Object