Interface VariantSortStrategy
- All Superinterfaces:
Comparator<VariantOptionData>
- All Known Implementing Classes:
DefaultVariantSortStrategy
Strategy that will provide comparator used for sorting variants for frontend view
-
Method Summary
Modifier and TypeMethodDescriptionvoidsetComparators(Map<String, Comparator<String>> comparators) Map of attribute - comparator.voidsetDefaultComparator(Comparator<String> defaultComparator) voidsetSortingFieldsOrder(List<String> fields) Sets the sorting fields order.Methods inherited from interface java.util.Comparator
compare, equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Method Details
-
setSortingFieldsOrder
Sets the sorting fields order. String array contains variant attributes that will be used to compare variants. When the method was not called or empty list was passed no sorting will be performed.- Parameters:
fields- the new sorting fields order
-
setComparators
Map of attribute - comparator. Where attribute is variant attribute to compare for sorting- Parameters:
comparators-
-
setDefaultComparator
- Parameters:
defaultComparator- for comparing variants' values - used as fallback, provide your own insetComparators(Map)
-