Package io.micronaut.data.model
Interface Sort
- All Known Subinterfaces:
CursoredPageable
,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 Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescription@NonNull List<Sort.Order>
boolean
isSorted()
static @NonNull Sort
of
(@Nullable List<Sort.Order> orderList) Create a sort from the given list of orders.static @NonNull Sort
of
(Sort.Order... orders) Creates a sort from an array orders.@NonNull Sort
Orders by the specified property name (defaults to ascending).@NonNull Sort
order
(@NonNull String propertyName, Sort.Order.Direction direction) Orders by the specified property name and direction.@NonNull Sort
order
(Sort.Order order) Adds an order object.default @NonNull Sort
orders
(@NonNull List<Sort.Order> orders) Adds an orders.static Sort
unsorted()
-
Field Details
-
UNSORTED
Constant for unsorted.
-
-
Method Details
-
isSorted
boolean isSorted()- Returns:
- Is sorting applied
-
order
Orders by the specified property name (defaults to ascending).- Parameters:
propertyName
- The property name to order by- Returns:
- A new sort with the order applied
-
order
Adds an order object.- Parameters:
order
- The order object- Returns:
- A new sort with the order applied
-
orders
Adds an orders.- Parameters:
orders
- The orders- Returns:
- A new sort with the order applied
- Since:
- 4.10
-
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 bydirection
- 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.
-
of
Create a sort from the given list of orders.- Parameters:
orderList
- The order list- Returns:
- The sort
-
of
Creates a sort from an array orders.- Parameters:
orders
- The orders- Returns:
- The orders
-