Class MapConfig.Builder

java.lang.Object
software.amazon.lambda.durable.config.MapConfig.Builder
Enclosing class:
MapConfig

public static class MapConfig.Builder extends Object
Builder for creating MapConfig instances.
  • Field Details

  • Method Details

    • maxConcurrency

      public MapConfig.Builder maxConcurrency(Integer maxConcurrency)
    • completionConfig

      public MapConfig.Builder completionConfig(CompletionConfig completionConfig)
      Sets the completion criteria for the map operation.
      Parameters:
      completionConfig - the completion configuration (default: CompletionConfig.allCompleted())
      Returns:
      this builder for method chaining
    • serDes

      public MapConfig.Builder serDes(SerDes 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

      public MapConfig.Builder nestingType(NestingType nestingType)
      Sets the nesting type for the map operation.
      Parameters:
      nestingType - the nesting type (default: NestingType.NESTED)
      Returns:
      this builder for method chaining
    • itemNamer

      public MapConfig.Builder itemNamer(BiFunction<Object,Integer,String> 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.FLAT because 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 of Object:

      
       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 a ClassCastException naming the offending type.

      Type Parameters:
      I - the map item type accepted by the namer
      Parameters:
      itemType - the class of the map's items
      itemNamer - the item namer, or null to use default iteration naming
      Returns:
      this builder for method chaining
    • build

      public MapConfig build()