Package org.bremersee.comparator.model
Class SortOrder
java.lang.Object
org.bremersee.comparator.model.SortOrder
- All Implemented Interfaces:
Serializable
The sort order is a list of sort order items.
- Author:
- Christian Bremer
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiates an empty sort order.SortOrder(Collection<? extends SortOrderItem> sortOrderItems) Instantiates a new unmodifiable sort order. -
Method Summary
Modifier and TypeMethodDescriptionstatic SortOrderby(SortOrderItem... sortOrderItems) Creates new sort order with the given items.static SortOrderfromSortOrderText(String source) From sort order text.static SortOrderfromSortOrderText(String source, SortOrderTextSeparators separators) From sort order text.getItems()Gets the unmodifiable list of sort order items.Creates the sort order text of this ordering descriptions.getSortOrderText(SortOrderTextSeparators separators) Creates the sort order text of this ordering descriptions.booleanisEmpty()Checks whether the list of items is empty or not.booleanisSorted()Checks whether this sort order contains any entries.booleanChecks whether this sort order contains any entries.toString()static SortOrderunsorted()
-
Field Details
-
DEFAULT_SEPARATOR
The constant DEFAULT_SEPARATOR.- See Also:
-
-
Constructor Details
-
SortOrder
protected SortOrder()Instantiates an empty sort order. -
SortOrder
Instantiates a new unmodifiable sort order.- Parameters:
sortOrderItems- the sort order items
-
-
Method Details
-
getItems
Gets the unmodifiable list of sort order items.- Returns:
- the list of sort order items
-
isEmpty
public boolean isEmpty()Checks whether the list of items is empty or not.- Returns:
trueif the list of items is empty, otherwisefalse
-
isSorted
public boolean isSorted()Checks whether this sort order 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 order 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
-
getSortOrderText
Creates the sort order text of this ordering descriptions.The syntax of the ordering description is
fieldNameOrPath0,direction,case-handling,null-handling;fieldNameOrPath1,direction,case-handling,null-handling
For example
created,desc;person.lastName,asc;person.firstName,asc
- Returns:
- the sort order text
-
getSortOrderText
Creates the sort order text of this ordering descriptions.The syntax of the ordering description is
fieldNameOrPath0,direction,case-handling,null-handling;fieldNameOrPath1,direction,case-handling,null-handling
For example
created,desc;person.lastName,asc;person.firstName,asc
- Parameters:
separators- the separators- Returns:
- the sort order text
-
toString
-
fromSortOrderText
From sort order text.- Parameters:
source- the sort order text- Returns:
- the sort order
-
fromSortOrderText
From sort order text.- Parameters:
source- the sort order textseparators- the separators- Returns:
- the sort order
-
by
Creates new sort order with the given items.- Parameters:
sortOrderItems- the sort orders- Returns:
- the sort order
-
unsorted
-