Class PriceInfoComparator
java.lang.Object
com.broadleafcommerce.catalogbrowse.service.provider.external.pricing.PriceInfoComparator
- All Implemented Interfaces:
Comparator<com.broadleafcommerce.pricing.client.domain.PriceInfo>
public class PriceInfoComparator
extends Object
implements Comparator<com.broadleafcommerce.pricing.client.domain.PriceInfo>
A comparator for comparing
PriceInfo based on the precedence of each price according to
this priority:
- Whether it's from a Price List. A price from a Price List takes precedence over a non-PriceList price, e.g. product's default price
- If it is from a Price List, compares the price source.
DefaultPriceListPriceSources.BLC_PRICE_LIST_PRICE_DATAtakes precedence overDefaultPriceListPriceSources.BLC_PRICE_LIST_FORMULA, and then everything else. - Finally, the lowest price wins
- Since:
- 1.8.8, 2.0.1
- Author:
- Sunny Yu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompare(com.broadleafcommerce.pricing.client.domain.PriceInfo p1, com.broadleafcommerce.pricing.client.domain.PriceInfo p2) protected intcompareByPriceList(com.broadleafcommerce.pricing.client.domain.PriceInfo p1, com.broadleafcommerce.pricing.client.domain.PriceInfo p2) protected intcompareByPriceListPriceSource(com.broadleafcommerce.pricing.client.domain.PriceInfo p1, com.broadleafcommerce.pricing.client.domain.PriceInfo p2) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
PriceInfoComparator
public PriceInfoComparator()
-
-
Method Details
-
compare
public int compare(com.broadleafcommerce.pricing.client.domain.PriceInfo p1, com.broadleafcommerce.pricing.client.domain.PriceInfo p2) - Specified by:
comparein interfaceComparator<com.broadleafcommerce.pricing.client.domain.PriceInfo>
-
compareByPriceList
protected int compareByPriceList(com.broadleafcommerce.pricing.client.domain.PriceInfo p1, com.broadleafcommerce.pricing.client.domain.PriceInfo p2) -
compareByPriceListPriceSource
protected int compareByPriceListPriceSource(com.broadleafcommerce.pricing.client.domain.PriceInfo p1, com.broadleafcommerce.pricing.client.domain.PriceInfo p2)
-