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
Modifier and TypeFieldDescriptionprotected BigDecimal
The discount amount that this tier represents.protected String
Determines the method used to apply the discount.protected BigDecimal
The minimum currency amount to qualify for this tier.protected Long
The minimum quantity of items needed to reach this tier.Fields inherited from interface com.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
DEFAULT_FIELD_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
int
compareTo
(DiscountTier that) Compares priorities.boolean
The discount amount that this tier represents.com.broadleafcommerce.data.tracking.core.EmbeddedContextState
A subset ofTracking
information 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.int
hashCode()
void
setAmount
(BigDecimal amount) The discount amount that this tier represents.void
setContextState
(com.broadleafcommerce.data.tracking.core.EmbeddedContextState contextState) A subset ofTracking
information to expose the context state for this object.void
setMethodType
(String methodType) Determines the method used to apply the discount.void
setMinAmount
(BigDecimal minAmount) The minimum currency amount to qualify for this tier.void
setMinQuantity
(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.amount
of the parentOffer
. -
methodType
Determines the method used to apply the discount. The method can beDiscountMethodType.PERCENT_OFF
,DiscountMethodType.AMOUNT_OFF
, orDiscountMethodType.FIXED_PRICE
. OverridesDiscount.methodType
of the parentOffer
.- See Also:
-
-
Constructor Details
-
DiscountTier
public DiscountTier()
-
-
Method Details
-
compareTo
Compares priorities. Null is less than non-null.- Specified by:
compareTo
in 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.amount
of the parentOffer
.- Specified by:
getAmount
in interfaceDiscountAmountTypeHolder
-
getMethodType
Determines the method used to apply the discount. The method can beDiscountMethodType.PERCENT_OFF
,DiscountMethodType.AMOUNT_OFF
, orDiscountMethodType.FIXED_PRICE
. OverridesDiscount.methodType
of the parentOffer
.- Specified by:
getMethodType
in interfaceDiscountAmountTypeHolder
- Returns:
- The method to use to apply this discount
- See Also:
-
getContextState
public com.broadleafcommerce.data.tracking.core.EmbeddedContextState getContextState()A subset ofTracking
information to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when theChangeDetails
for the parent object's entireattributes
map are compared.- Specified by:
getContextState
in interfacecom.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
- Returns:
- a subset of
Tracking
information 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.amount
of the parentOffer
. -
setMethodType
Determines the method used to apply the discount. The method can beDiscountMethodType.PERCENT_OFF
,DiscountMethodType.AMOUNT_OFF
, orDiscountMethodType.FIXED_PRICE
. OverridesDiscount.methodType
of 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 ofTracking
information to expose the context state for this object. This value is not persisted, and instead it is dynamically calculated and populated when theChangeDetails
for the parent object's entireattributes
map are compared.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.EmbeddedContextStateAware
- Parameters:
contextState
- a subset ofTracking
information to expose the context state for this object
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-