Class QualifierLineItemOfferDetailComparator
java.lang.Object
com.broadleafcommerce.promotion.offer.service.dto.comparator.QualifierLineItemOfferDetailComparator
- All Implemented Interfaces:
Comparator<LineItemOfferDetail>
public class QualifierLineItemOfferDetailComparator
extends Object
implements Comparator<LineItemOfferDetail>
Comparator
for LineItemOfferDetails
being used as qualifiers
for offers. Orders by either the standard or sale price of the details' LineItems
.
AComparator
was used instead ofLineItemOfferDetail
implementingComparable
because we need a flag to determine whether to use the sale price or standard price in the comparison. SeeuseSalePrice
.
- Author:
- Nathan Moore (nathanmoore).
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
int
Orders by highest amount first.boolean
int
hashCode()
boolean
Determines whether to compareLineItemOfferDetails
using theirEnhancedLineItem.getSalePrice()
instead ofEnhancedLineItem.getStandardPrice()
.void
setUseSalePrice
(boolean useSalePrice) Determines whether to compareLineItemOfferDetails
using theirEnhancedLineItem.getSalePrice()
instead ofEnhancedLineItem.getStandardPrice()
.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
QualifierLineItemOfferDetailComparator
public QualifierLineItemOfferDetailComparator(boolean useSalePrice) -
QualifierLineItemOfferDetailComparator
public QualifierLineItemOfferDetailComparator()
-
-
Method Details
-
compare
Orders by highest amount first.- Specified by:
compare
in interfaceComparator<LineItemOfferDetail>
-
isUseSalePrice
public boolean isUseSalePrice()Determines whether to compareLineItemOfferDetails
using theirEnhancedLineItem.getSalePrice()
instead ofEnhancedLineItem.getStandardPrice()
.- Returns:
- whether to compare
LineItemOfferDetails
using theirEnhancedLineItem.getSalePrice()
instead ofEnhancedLineItem.getStandardPrice()
.
-
setUseSalePrice
public void setUseSalePrice(boolean useSalePrice) Determines whether to compareLineItemOfferDetails
using theirEnhancedLineItem.getSalePrice()
instead ofEnhancedLineItem.getStandardPrice()
.- Parameters:
useSalePrice
- whether to compareLineItemOfferDetails
using theirEnhancedLineItem.getSalePrice()
instead ofEnhancedLineItem.getStandardPrice()
.
-
equals
- Specified by:
equals
in interfaceComparator<LineItemOfferDetail>
- Overrides:
equals
in classObject
-
canEqual
-
hashCode
public int hashCode() -
toString
-