public class KeyValueSorting
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ASCENDING
indicates ascending order
|
static int |
DESCENDING
indicates ascending order
|
Constructor and Description |
---|
KeyValueSorting() |
Modifier and Type | Method and Description |
---|---|
static <RecordType> |
comparatorForKeyPath(KeyValueAdaptor adaptor,
java.lang.String keyPath,
int order)
Generate a comparator that compares records according to the method obtained by the key value adaptor
The keyed values being compared are assumed to be comparable.
|
static <RecordType> |
comparatorForKeyPath(java.lang.String keyPath,
int order)
Generate a comparator that compares records according to the method obtained by a key value adaptor generated internally.
|
static <RecordType> |
compoundComparator(java.util.Comparator<RecordType>... comparators)
Coalesce the specified comparators to generate a compound comparator whose sub comparators are evaluated in the specified order.
|
public static final int DESCENDING
public static final int ASCENDING
public static <RecordType> java.util.Comparator<RecordType> comparatorForKeyPath(java.lang.String keyPath, int order)
keyPath
- indicates the method used for comparisonorder
- either ASCENDING or DESCENDINGpublic static <RecordType> java.util.Comparator<RecordType> comparatorForKeyPath(KeyValueAdaptor adaptor, java.lang.String keyPath, int order)
adaptor
- key value adaptor used for getting the method associated with the keykeyPath
- indicates the method used for comparisonorder
- either ASCENDING or DESCENDING@SafeVarargs public static <RecordType> java.util.Comparator<RecordType> compoundComparator(java.util.Comparator<RecordType>... comparators)
comparators
- array of parameters to coalesce taken in order (sort first by the first comparator and last by the last comparator)