Class MapConfig.Builder
java.lang.Object
software.amazon.lambda.durable.config.MapConfig.Builder
- Enclosing class:
- MapConfig
Builder for creating MapConfig instances.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbuild()completionConfig(CompletionConfig completionConfig) Sets the completion criteria for the map operation.itemNamer(Class<I> itemType, BiFunction<? super I, Integer, String> itemNamer) Sets a function that names each nested map iteration, typed to the map's item class.itemNamer(BiFunction<Object, Integer, String> itemNamer) Sets a function that names each nested map iteration.maxConcurrency(Integer maxConcurrency) nestingType(NestingType nestingType) Sets the nesting type for the map operation.Sets the custom serializer to use for serializing map items and results.
-
Field Details
-
nestingType
-
-
Method Details
-
maxConcurrency
-
completionConfig
Sets the completion criteria for the map operation.- Parameters:
completionConfig- the completion configuration (default:CompletionConfig.allCompleted())- Returns:
- this builder for method chaining
-
serDes
Sets the custom serializer to use for serializing map items and results.- Parameters:
serDes- the serializer to use- Returns:
- this builder for method chaining
-
nestingType
Sets the nesting type for the map operation.- Parameters:
nestingType- the nesting type (default:NestingType.NESTED)- Returns:
- this builder for method chaining
-
itemNamer
Sets a function that names each nested map iteration.The function receives the item and its zero-based index. Returning null creates an unnamed iteration. Non-null names are validated before the map allocates an operation ID or emits a checkpoint. Item naming is not supported with
NestingType.FLATbecause flat iterations do not have context operations.- Parameters:
itemNamer- the item namer, or null to use default iteration naming- Returns:
- this builder for method chaining
-
itemNamer
public <I> MapConfig.Builder itemNamer(Class<I> itemType, BiFunction<? super I, Integer, String> itemNamer) Sets a function that names each nested map iteration, typed to the map's item class.Equivalent to
itemNamer(BiFunction), but the item type is declared explicitly so the namer can accept the item directly instead ofObject:MapConfig.builder().itemNamer(Order.class, (order, index) -> order.id()).build();Each item is passed through
Class.cast(java.lang.Object), so supplying a class that does not match the map's items fails with aClassCastExceptionnaming the offending type.- Type Parameters:
I- the map item type accepted by the namer- Parameters:
itemType- the class of the map's itemsitemNamer- the item namer, or null to use default iteration naming- Returns:
- this builder for method chaining
-
build
-