public class Sort extends Object
| Constructor and Description |
|---|
Sort() |
Sort(String name,
SortType type) |
Sort(String name,
SortType type,
boolean nullsFirst) |
| Modifier and Type | Method and Description |
|---|---|
static Sort |
asc(String name)
Creates an ascending sort.
|
Comparator |
comparator(Map<String,FieldAccess> fields)
This is what really does the magic.
|
static Sort |
desc(String name)
Creates a descending sort.
|
static Sort |
descNullsFirst(String name)
Creates an descending sort.
|
int |
doHashCode() |
boolean |
equals(Object o) |
String |
getName() |
SortType |
getType() |
int |
hashCode() |
<T> Collection<T> |
sort(Class<T> componentClass,
Collection<T> collection)
Sort and you look up the reflection fields.
|
<T> Iterable<T> |
sort(Class<T> componentClass,
Iterable<T> iterable)
Sort and you look up the reflection fields.
|
void |
sort(List list)
Sort and you look up the reflection fields.
|
void |
sort(List list,
Map<String,FieldAccess> fields)
Sort if you already know the reflection fields.
|
<T> void |
sort(T[] array)
Sort and you look up the reflection fields.
|
static Sort |
sortBy(String name)
Creates an ascending sort.
|
static Sort |
sortByDesc(String name)
Creates a descending sort.
|
static Sort |
sortByDescending(String name)
Creates a descending sort.
|
static Sort |
sortByDescendingNullsFirst(String name)
Creates an descending sort.
|
static Sort |
sortByNullsFirst(String name)
Creates an ascending sort.
|
static Sort |
sorts(Sort... sorts)
Helper method to create a Sort that is a composite of other sorts.
|
Sort |
then(Sort sort) |
Sort |
then(String name) |
Sort |
thenAsc(String name) |
Sort |
thenDesc(String name) |
String |
toString() |
public static Sort sorts(Sort... sorts)
sorts - list of child sortspublic static Sort sortByDescendingNullsFirst(String name)
public SortType getType()
public String getName()
public void sort(List list, Map<String,FieldAccess> fields)
list - sort from listfields - sort from fields.public void sort(List list)
list - public <T> Collection<T> sort(Class<T> componentClass, Collection<T> collection)
collection - the collection to sortpublic <T> Iterable<T> sort(Class<T> componentClass, Iterable<T> iterable)
iterable - the collection to sortpublic <T> void sort(T[] array)
array - public Comparator comparator(Map<String,FieldAccess> fields)
public int doHashCode()
Copyright © 2015. All Rights Reserved.