K - Key type.@Experimental public class SortBy<K> extends Object implements PostProcessingOperation<K,Object>
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<K>> properties)
Creates a new SORTBY operation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
build(CommandArgs<K,Object> args)
Build the operation arguments into the command args.
|
static <K> SortBy<K> |
of(K property,
SortDirection direction)
Static factory method to create a SortBy instance with a single property.
|
static <K> SortBy<K> |
of(SortProperty<K>... properties)
Static factory method to create a SortBy instance with multiple properties.
|
public SortBy(List<SortProperty<K>> properties)
properties - the properties to sort bypublic static <K> SortBy<K> of(K property, SortDirection direction)
K - Key typeproperty - the property to sort bydirection - the sort direction@SafeVarargs public static <K> SortBy<K> of(SortProperty<K>... properties)
K - Key typeproperties - the properties to sort bypublic void build(CommandArgs<K,Object> args)
PostProcessingOperationbuild in interface PostProcessingOperation<K,Object>args - the command args to build intoCopyright © 2026 lettuce.io. All rights reserved.