Class LineItemDiscount

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getApplicableUnits()
      In case this discount applied per unit this returns the maximum number of units that it should apply to.
      boolean isPerUnit()
      Tell whether this discount should be applied for each unit or just once for the whole line.
      void setApplicableUnits​(int numberOfUnits)
      For the case this discount applies per unit this method changes the maximum number of units to apply to.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • 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:
        isPerUnit()
      • 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:
        isPerUnit(), getApplicableUnits()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object