Package io.micronaut.data.model
Interface Sort
- All Known Subinterfaces:
- Pageable
@DefaultImplementation(io.micronaut.data.model.DefaultSort.class)
public interface Sort
An interface for objects that can be sorted. Sorted instances are immutable and all mutating operations on this interface return a new instance.
- Since:
- 1.0
- Author:
- graemerocher
- 
Nested Class SummaryNested Classes
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescription@NonNull List<Sort.Order>booleanisSorted()static @NonNull Sortof(@Nullable List<Sort.Order> orderList) Create a sort from the given list of orders.static @NonNull Sortof(Sort.Order... orders) Creates a sort from an array orders.@NonNull SortOrders by the specified property name (defaults to ascending).@NonNull Sortorder(@NonNull String propertyName, Sort.Order.Direction direction) Orders by the specified property name and direction.@NonNull Sortorder(Sort.Order order) Adds an order object.static Sortunsorted()
- 
Field Details- 
UNSORTEDConstant for unsorted.
 
- 
- 
Method Details- 
isSortedboolean isSorted()- Returns:
- Is sorting applied
 
- 
orderOrders by the specified property name (defaults to ascending).- Parameters:
- propertyName- The property name to order by
- Returns:
- A new sort with the order applied
 
- 
orderAdds an order object.- Parameters:
- order- The order object
- Returns:
- A new sort with the order applied
 
- 
order@NonNull @NonNull Sort order(@NonNull @NonNull String propertyName, @NonNull Sort.Order.Direction direction) Orders by the specified property name and direction.- Parameters:
- propertyName- The property name to order by
- direction- Either "asc" for ascending or "desc" for descending
- Returns:
- A new sort with the order applied
 
- 
getOrderBy- Returns:
- The order definitions for this sort.
 
- 
unsorted- Returns:
- Default unsorted sort instance.
 
- 
ofCreate a sort from the given list of orders.- Parameters:
- orderList- The order list
- Returns:
- The sort
 
- 
ofCreates a sort from an array orders.- Parameters:
- orders- The orders
- Returns:
- The orders
 
 
-