Class Sorting
- java.lang.Object
-
- de.digitalcollections.model.paging.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.
-
-
Field Summary
Fields Modifier and Type Field Description static DirectionDEFAULT_DIRECTION
-
Constructor Summary
Constructors Constructor Description Sorting()Sorting(Direction direction, String... properties)Creates a newSortinginstance.Sorting(Direction direction, List<String> properties)Creates a newSortinginstance.Sorting(Order... orders)Sorting(String... properties)Creates a newSortinginstance.Sorting(List<Order> orders)Creates a newSortinginstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Sortingand(Sorting sort)static SortingBuilderdefaultBuilder()booleanequals(Object obj)OrdergetOrderFor(String property)Returns the order registered for the given property.List<Order>getOrders()inthashCode()Iterator<Order>iterator()voidsetOrders(List<Order> orders)StringtoString()-
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 newSortinginstance.- Parameters:
orders- must not be null or contain null.
-
Sorting
public Sorting(String... properties)
Creates a newSortinginstance. 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 newSortinginstance.- 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 newSortinginstance.- Parameters:
direction- defaults toDEFAULT_DIRECTION(for null cases, too)properties- must not be null or contain null or empty strings.
-
-
Method Detail
-
defaultBuilder
public static SortingBuilder defaultBuilder()
-
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
-
-