public static class AggregateArgs.Apply<K,V> extends Object implements AggregateArgs.PipelineOperation<K,V>
Applies a 1-to-1 transformation on one or more properties and either stores the result as a new property down the pipeline or replaces any property using this transformation. APPLY can perform arithmetic operations on numeric properties or apply functions depending on property types.
{
@code
// Calculate total value from price and quantity
Apply totalValue = new Apply<>("@price * @quantity", "total_value");
// Mathematical operations
Apply discount = new Apply<>("@price * 0.9", "discounted_price");
// String operations
Apply fullName = new Apply<>("@first_name + ' ' + @last_name", "full_name");
// Date operations
Apply dayOfWeek = new Apply<>("day(@timestamp)", "day");
}
The expression is evaluated dynamically for each record in the pipeline and the result is stored as a new property that can be referenced by further operations.
| Modifier and Type | Method and Description |
|---|---|
void |
build(CommandArgs<K,V> args)
Build the operation arguments into the command args.
|
static <K,V> AggregateArgs.Apply<K,V> |
of(V expression,
K name)
Static factory method to create an Apply instance with a single name and expression pair.
|
public void build(CommandArgs<K,V> args)
AggregateArgs.PipelineOperationbuild in interface AggregateArgs.PipelineOperation<K,V>args - the command args to build intopublic static <K,V> AggregateArgs.Apply<K,V> of(V expression, K name)
K - Key typeV - Value typename - the name of the expressionexpression - the expression to applyCopyright © 2025 lettuce.io. All rights reserved.