@Experimental public class SortBy extends Object implements PostProcessingOperation
Sorts the pipeline results up until the point of SORTBY, using a list of properties. By default, sorting is ascending, but ASC or DESC can be specified for each property.
{
@code
// Simple sort by single field
SortBy sortBy = SortBy.of("price", SortDirection.DESC);
// Multiple sort criteria
SortBy multiSort = SortBy.of(SortProperty.of("category", SortDirection.ASC),
SortProperty.of("price", SortDirection.DESC));
}
SortProperty,
SortDirection,
PostProcessingOperation| Constructor and Description |
|---|
SortBy(List<SortProperty> properties)
Creates a new SORTBY operation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
build(CommandArgs<?,?> args)
Build the operation arguments into the command args.
|
static SortBy |
of(SortProperty... properties)
Static factory method to create a SortBy instance with multiple properties.
|
static SortBy |
of(String property,
SortDirection direction)
Static factory method to create a SortBy instance with a single property.
|
public SortBy(List<SortProperty> properties)
properties - the properties to sort bypublic static SortBy of(String property, SortDirection direction)
property - the property to sort bydirection - the sort direction@SafeVarargs public static SortBy of(SortProperty... properties)
properties - the properties to sort bypublic void build(CommandArgs<?,?> args)
PostProcessingOperationbuild in interface PostProcessingOperationargs - the command args to build intoCopyright © 2026 lettuce.io. All rights reserved.