public class SortOption extends Object implements Repository.Option
Repository
option for sorting aggregates.Modifier and Type | Class and Description |
---|---|
static class |
SortOption.Direction
Sort direction associated to a sorted attribute.
|
static class |
SortOption.SortedAttribute
Represents a specific sorted attribute in a
SortOption . |
Constructor and Description |
---|
SortOption()
Creates an empty sort option with
SortOption.Direction.ASCENDING as default sort direction. |
SortOption(SortOption.Direction defaultDirection)
Creates an empty sort option with the specified argument as default sort direction.
|
Modifier and Type | Method and Description |
---|---|
SortOption |
add(String attribute)
Adds the specified attribute to the list of sorted attributes with the default direction.
|
SortOption |
add(String attribute,
SortOption.Direction direction)
Adds the specified attribute to the list of sorted attributes with the specified direction.
|
<T> Comparator<T> |
buildComparator()
Builds a comparator allowing the sorting of objects according to the sort criteria.
|
List<SortOption.SortedAttribute> |
getSortedAttributes()
Returns the sorted attributes.
|
public SortOption()
SortOption.Direction.ASCENDING
as default sort direction.public SortOption(SortOption.Direction defaultDirection)
defaultDirection
- the default sort direction.public SortOption add(String attribute)
attribute
- the attribute to sort.public SortOption add(String attribute, SortOption.Direction direction)
attribute
- the attribute to sort.direction
- the direction this attribute will be sorted with.public List<SortOption.SortedAttribute> getSortedAttributes()
public <T> Comparator<T> buildComparator()
T
- the type of the object to compare.Copyright © 2013-2018–2019 SeedStack. All rights reserved.