Package org.bremersee.comparator.model
Class SortOrders
- java.lang.Object
-
- org.bremersee.comparator.model.SortOrders
-
@Valid public class SortOrders extends Object
The list of sort orders.- Author:
- Christian Bremer
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSortOrders()Instantiates an empty list of sort orders.SortOrders(Collection<? extends SortOrder> sortOrders)Instantiates a new unmodifiable list of sort orders.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SortOrdersby(SortOrder... sortOrders)Creates new sort orders with the given orders.static SortOrdersfromSortOrdersText(String source)From sort orders text.static SortOrdersfromSortOrdersText(String source, SortOrdersTextProperties properties)From sort orders text.List<SortOrder>getSortOrders()Gets the unmodifiable list of sort orders.booleanisEmpty()Checks whether the list of sort orders is empty or not.booleanisSorted()Checks whether this sort orders contains any entries.booleanisUnsorted()Checks whether this sort orders contains any entries.@NotEmpty StringtoSortOrdersText()Creates the sort orders text of this ordering descriptions.@NotEmpty StringtoSortOrdersText(SortOrdersTextProperties properties)Creates the sort orders text of this ordering descriptions.StringtoString()
-
-
-
Constructor Detail
-
SortOrders
protected SortOrders()
Instantiates an empty list of sort orders.
-
SortOrders
public SortOrders(Collection<? extends SortOrder> sortOrders)
Instantiates a new unmodifiable list of sort orders.- Parameters:
sortOrders- the sort orders
-
-
Method Detail
-
getSortOrders
public List<SortOrder> getSortOrders()
Gets the unmodifiable list of sort orders.- Returns:
- the list of sort orders
-
isEmpty
public boolean isEmpty()
Checks whether the list of sort orders is empty or not.- Returns:
trueif the list of sort orders is empty, otherwisefalse
-
isSorted
public boolean isSorted()
Checks whether this sort orders contains any entries. If there are entries, this is sorted, otherwise it is unsorted.- Returns:
trueif the list of sort orders is not empty (aka sorted), otherwisefalse
-
isUnsorted
public boolean isUnsorted()
Checks whether this sort orders contains any entries. If there are no entries, this is unsorted, otherwise it is sorted.- Returns:
trueif the list of sort orders is empty (aka unsorted), otherwisefalse
-
toSortOrdersText
@NotEmpty public @NotEmpty String toSortOrdersText()
Creates the sort orders text of this ordering descriptions.The syntax of the ordering description is
fieldNameOrPath0,asc,ignoreCase,nullIsFirst;fieldNameOrPath1,asc,ignoreCase,nullIsFirst
For example
room.number,asc,true,false;person.lastName,asc,true,false;person.firstName,asc,true,false
- Returns:
- the sort orders text
-
toSortOrdersText
@NotEmpty public @NotEmpty String toSortOrdersText(SortOrdersTextProperties properties)
Creates the sort orders text of this ordering descriptions.The syntax of the ordering description is
fieldNameOrPath0,asc,ignoreCase,nullIsFirst;fieldNameOrPath1,asc,ignoreCase,nullIsFirst
The separators (',') and (';') and the values of
direction,case-handlingandnull-handlingdepend on the givenSortOrdersTextProperties.For example with default properties:
room.number,asc,true,false;person.lastName,asc,true,false;person.firstName,asc,true,false
- Parameters:
properties- the properties- Returns:
- the sort orders text
-
fromSortOrdersText
public static SortOrders fromSortOrdersText(String source)
From sort orders text.- Parameters:
source- the sort orders text- Returns:
- the sort orders
-
fromSortOrdersText
public static SortOrders fromSortOrdersText(String source, SortOrdersTextProperties properties)
From sort orders text.- Parameters:
source- the sort orders textproperties- the properties- Returns:
- the sort orders
-
by
public static SortOrders by(SortOrder... sortOrders)
Creates new sort orders with the given orders.- Parameters:
sortOrders- the sort orders- Returns:
- the sort orders
-
-