Package org.jxls.util
Class OrderByComparator<T>
java.lang.Object
org.jxls.util.OrderByComparator<T>
- All Implemented Interfaces:
Comparator<T>
An OrderByComparator is a Comparator that is
capable of comparing two objects based on a dynamic list of properties of
the objects of type T. It can sort any of its properties
ascending or descending, and for any of its properties, it can place nulls
first or last. Like SQL, this will default to ascending. Nulls default to
last if ascending, and first if descending.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOrderByComparator(List<String> expressions) Constructs anOrderByComparatorbased on aListof expressions, of the format "property [ASC|DESC]". -
Method Summary
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
-
Field Details
-
ASC
Sort ascending and don't ignore case (default).- See Also:
-
ASC_IGNORECASE
Sort ascending and ignore case.- See Also:
-
DESC
Sort descending and don't ignore case.- See Also:
-
DESC_IGNORECASE
Sort descending and ignore case.- See Also:
-
-
Constructor Details
-
OrderByComparator
Constructs anOrderByComparatorbased on aListof expressions, of the format "property [ASC|DESC]".- Parameters:
expressions- AListof expressions.- Throws:
JxlsException- If there is a problem parsing the expressions.
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<T>- Throws:
UnsupportedOperationException
-