Class Sorting
- java.lang.Object
-
- de.digitalcollections.model.list.sorting.Sorting
-
public class Sorting extends Object implements Iterable<Order>
SortingImpl option for queries. You have to provide at least a list of properties to sort for that must not include null or empty strings. The direction defaults toDEFAULT_DIRECTION
. See Spring Data Commons, but more flat design and independent of Spring libraries.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Sorting.Builder
-
Field Summary
Fields Modifier and Type Field Description static Direction
DEFAULT_DIRECTION
-
Constructor Summary
Constructors Constructor Description Sorting()
Sorting(Direction direction, String... properties)
Creates a newSorting
instance.Sorting(Direction direction, List<String> properties)
Creates a newSorting
instance.Sorting(Order... orders)
Sorting(String... properties)
Creates a newSorting
instance.Sorting(List<Order> orders)
Creates a newSorting
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Sorting
and(Sorting sort)
static Sorting.Builder
builder()
boolean
equals(Object obj)
Order
getOrderFor(String property)
Returns the order registered for the given property.List<Order>
getOrders()
int
hashCode()
Iterator<Order>
iterator()
void
setOrders(List<Order> orders)
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
DEFAULT_DIRECTION
public static final Direction DEFAULT_DIRECTION
-
-
Constructor Detail
-
Sorting
public Sorting()
-
Sorting
public Sorting(Order... orders)
- Parameters:
orders
- must not be null.
-
Sorting
public Sorting(List<Order> orders)
Creates a newSorting
instance.- Parameters:
orders
- must not be null or contain null.
-
Sorting
public Sorting(String... properties)
Creates a newSorting
instance. Order defaults to Direction#ASC.- Parameters:
properties
- must not be null or contain null or empty strings
-
Sorting
public Sorting(Direction direction, String... properties)
Creates a newSorting
instance.- Parameters:
direction
- defaults toDEFAULT_DIRECTION
(for null cases, too)properties
- must not be null, empty or contain null or empty strings.
-
Sorting
public Sorting(Direction direction, List<String> properties)
Creates a newSorting
instance.- Parameters:
direction
- defaults toDEFAULT_DIRECTION
(for null cases, too)properties
- must not be null or contain null or empty strings.
-
-
Method Detail
-
builder
public static Sorting.Builder builder()
-
getOrderFor
public Order getOrderFor(String property)
Returns the order registered for the given property.- Parameters:
property
- given property- Returns:
- the order registered for the given property
-
-