Class BatchLoaderHandlerMethod


public class BatchLoaderHandlerMethod extends InvocableHandlerMethodSupport
An extension of HandlerMethod for annotated handler methods adapted to BatchLoaderWithContext or MappedBatchLoaderWithContext with the list of keys and BatchLoaderEnvironment as their input.
Since:
1.0.0
Author:
Rossen Stoyanchev
  • Constructor Details

    • BatchLoaderHandlerMethod

      @Deprecated(since="1.3.0", forRemoval=true) public BatchLoaderHandlerMethod(HandlerMethod handlerMethod, @Nullable Executor executor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor of alternative constructor
      Create an instance.
      Parameters:
      handlerMethod - the controller method
      executor - an Executor to use for Callable return values
    • BatchLoaderHandlerMethod

      public BatchLoaderHandlerMethod(HandlerMethod handlerMethod, @Nullable Executor executor, boolean invokeAsync)
      Create an instance.
      Parameters:
      handlerMethod - the controller method
      executor - an Executor to use for Callable return values
      invokeAsync - whether to invoke the method through the Executor
      Since:
      1.3.0
  • Method Details

    • invokeForMap

      @Nullable public <K, V> reactor.core.publisher.Mono<Map<K,V>> invokeForMap(Collection<K> keys, org.dataloader.BatchLoaderEnvironment environment)
      Invoke the underlying batch loader method with a collection of keys to return a Map of key-value pairs.
      Type Parameters:
      K - the type of keys in the map
      V - the type of values in the map
      Parameters:
      keys - the keys for which to load values
      environment - the environment available to batch loaders
      Returns:
      a Mono with map of key-value pairs.
    • invokeForIterable

      public <V> reactor.core.publisher.Flux<V> invokeForIterable(Collection<?> keys, org.dataloader.BatchLoaderEnvironment environment)
      Invoke the underlying batch loader method with a collection of input keys to return a collection of matching values.
      Type Parameters:
      V - the type of values returned
      Parameters:
      keys - the keys for which to load values
      environment - the environment available to batch loaders
      Returns:
      a Flux of values.