|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kuali.kfs.sys.DynamicCollectionComparator<T>
public class DynamicCollectionComparator<T>
The comparator can dynamically implement java.util.Comparator and facilitate to sort a given colletion. This implementation is based on an article by York Davis, which was published in Java Developer's Journal (http://java.sys-con.com/read/45837.htm).
Nested Class Summary | |
---|---|
static class |
DynamicCollectionComparator.SortOrder
enumerate the valid values of sort order |
Method Summary | ||
---|---|---|
int |
compare(T object0,
T object1)
compare the two given objects for order. |
|
int |
compare(T object0,
T object1,
String fieldName)
compare the two given objects for order. |
|
int |
getSortOrderAsNumber()
convert the sort order as an interger. |
|
static
|
sort(List<C> list,
DynamicCollectionComparator.SortOrder sortOrder,
String... fieldNames)
sort the given collection ordered by the given field name |
|
static
|
sort(List<C> list,
String... fieldNames)
sort the given collection ordered by the given field name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Method Detail |
---|
public static <C> void sort(List<C> list, String... fieldNames)
list
- the given collection that needs to be sortedfieldName
- the field name ordered bypublic static <C> void sort(List<C> list, DynamicCollectionComparator.SortOrder sortOrder, String... fieldNames)
list
- the given collection that needs to be sortedfieldName
- the field name ordered bysortOrder
- the given sort order, either ascending or descendingpublic int compare(T object0, T object1)
compare
in interface Comparator<T>
public int compare(T object0, T object1, String fieldName)
public int getSortOrderAsNumber()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |