Class DiscountTier
- java.lang.Object
-
- com.broadleafcommerce.promotion.offer.domain.DiscountTier
-
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware,Serializable,Comparable<DiscountTier>
public class DiscountTier extends Object implements Serializable, Comparable<DiscountTier>, com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BigDecimalamountThe discount amount that this tier represents.protected StringmethodTypeDetermines the method used to apply the discount.protected BigDecimalminAmountThe minimum currency amount to qualify for this tier.protected LongminQuantityThe minimum quantity of items needed to reach this tier.
-
Constructor Summary
Constructors Constructor Description DiscountTier()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)intcompareTo(DiscountTier that)Compares priorities.booleanequals(Object o)BigDecimalgetAmount()The discount amount that this tier represents.com.broadleafcommerce.data.tracking.core.EmbeddedContextStategetContextState()A subset ofTrackinginformation to expose the context state for this object.StringgetMethodType()Determines the method used to apply the discount.BigDecimalgetMinAmount()The minimum currency amount to qualify for this tier.LonggetMinQuantity()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.StringtoString()
-
-
-
Field Detail
-
minQuantity
protected Long minQuantity
The minimum quantity of items needed to reach this tier.
-
minAmount
protected BigDecimal minAmount
The minimum currency amount to qualify for this tier.
-
amount
protected BigDecimal 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
protected String 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:
DiscountMethodType
-
-
Method Detail
-
compareTo
public int compareTo(@NonNull DiscountTier that)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
public Long getMinQuantity()
The minimum quantity of items needed to reach this tier.
-
getMinAmount
public BigDecimal getMinAmount()
The minimum currency amount to qualify for this tier.
-
getAmount
public BigDecimal 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.
-
getMethodType
public String 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.- Returns:
- The method to use to apply this discount
- See Also:
DiscountMethodType
-
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
public void setMinQuantity(Long minQuantity)
The minimum quantity of items needed to reach this tier.
-
setMinAmount
public void setMinAmount(BigDecimal minAmount)
The minimum currency amount to qualify for this tier.
-
setAmount
public void setAmount(BigDecimal 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.
-
setMethodType
public void setMethodType(String 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.- Parameters:
methodType- The method to use to apply this discount- See Also:
DiscountMethodType
-
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
-
canEqual
protected boolean canEqual(Object other)
-
-