Class DiscountTier
java.lang.Object
com.broadleafcommerce.promotion.offer.domain.DiscountTier
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware,DiscountAmountTypeHolder,Serializable,Comparable<DiscountTier>
public class DiscountTier
extends Object
implements Serializable, Comparable<DiscountTier>, com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware, DiscountAmountTypeHolder
Represents a tier and amount combination for an offer's discount. For example, an offer might
allow a 10% off if a user purchases 1 through 5 of the same item but then allow 15% off if they
purchase more than 5 of that item.
Note that tiers only apply to item offers—not orders or fulfillment groups.
- Author:
- Chad Harchar (charchar)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BigDecimalThe discount amount that this tier represents.protected StringDetermines the method used to apply the discount.protected BigDecimalThe minimum currency amount to qualify for this tier.protected LongThe minimum quantity of items needed to reach this tier.Fields inherited from interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
DEFAULT_FIELD_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanintcompareTo(DiscountTier that) Compares priorities.booleanThe discount amount that this tier represents.com.broadleafcommerce.data.tracking.core.EmbeddedContextStateA subset ofTrackinginformation to expose the context state for this object.Determines the method used to apply the discount.The minimum currency amount to qualify for this tier.The minimum quantity of items needed to reach this tier.inthashCode()voidsetAmount(BigDecimal amount) The discount amount that this tier represents.voidsetContextState(com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState) A subset ofTrackinginformation to expose the context state for this object.voidsetMethodType(String methodType) Determines the method used to apply the discount.voidsetMinAmount(BigDecimal minAmount) The minimum currency amount to qualify for this tier.voidsetMinQuantity(Long minQuantity) The minimum quantity of items needed to reach this tier.toString()
-
Field Details
-
minQuantity
The minimum quantity of items needed to reach this tier. -
minAmount
The minimum currency amount to qualify for this tier. -
amount
The discount amount that this tier represents. If the amount is10, then whether it is calculated as a percentage (10%) or a currency amount ($10) is determined bymethodType. OverridesDiscount.amountof the parentOffer. -
methodType
Determines the method used to apply the discount. The method can beDiscountMethodType.PERCENT_OFF,DiscountMethodType.AMOUNT_OFF, orDiscountMethodType.FIXED_PRICE. OverridesDiscount.methodTypeof the parentOffer.- See Also:
-
-
Constructor Details
-
DiscountTier
public DiscountTier()
-
-
Method Details
-
compareTo
Compares priorities. Null is less than non-null.- Specified by:
compareToin interfaceComparable<DiscountTier>- Parameters:
that- DiscountTier to which we are comparing- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
getMinQuantity
The minimum quantity of items needed to reach this tier. -
getMinAmount
The minimum currency amount to qualify for this tier. -
getAmount
The discount amount that this tier represents. If the amount is10, then whether it is calculated as a percentage (10%) or a currency amount ($10) is determined bymethodType. OverridesDiscount.amountof the parentOffer.- Specified by:
getAmountin interfaceDiscountAmountTypeHolder
-
getMethodType
Determines the method used to apply the discount. The method can beDiscountMethodType.PERCENT_OFF,DiscountMethodType.AMOUNT_OFF, orDiscountMethodType.FIXED_PRICE. OverridesDiscount.methodTypeof the parentOffer.- Specified by:
getMethodTypein interfaceDiscountAmountTypeHolder- Returns:
- The method to use to apply this discount
- See Also:
-
getContextState
public com.broadleafcommerce.data.tracking.core.EmbeddedContextState getContextState()A subset ofTrackinginformation to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when theChangeDetailsfor the parent object's entireattributesmap are compared.- Specified by:
getContextStatein interfacecom.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware- Returns:
- a subset of
Trackinginformation to expose the context state for this object
-
setMinQuantity
The minimum quantity of items needed to reach this tier. -
setMinAmount
The minimum currency amount to qualify for this tier. -
setAmount
The discount amount that this tier represents. If the amount is10, then whether it is calculated as a percentage (10%) or a currency amount ($10) is determined bymethodType. OverridesDiscount.amountof the parentOffer. -
setMethodType
Determines the method used to apply the discount. The method can beDiscountMethodType.PERCENT_OFF,DiscountMethodType.AMOUNT_OFF, orDiscountMethodType.FIXED_PRICE. OverridesDiscount.methodTypeof the parentOffer.- Parameters:
methodType- The method to use to apply this discount- See Also:
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState) A subset ofTrackinginformation to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when theChangeDetailsfor the parent object's entireattributesmap are compared.- Specified by:
setContextStatein interfacecom.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware- Parameters:
contextState- a subset ofTrackinginformation to expose the context state for this object
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-