Interface BatchLoaderWithContext<K,V extends @Nullable Object>


@PublicSpi @NullMarked public interface BatchLoaderWithContext<K,V extends @Nullable Object>
This form of BatchLoader is given a BatchLoaderEnvironment object that encapsulates the calling context. A typical use case is passing in security credentials or database connection details say. See BatchLoader for more details on the design invariants that you must implement in order to use this interface.
  • Method Summary

    Modifier and Type
    Method
    Description
    load(List<K> keys, BatchLoaderEnvironment environment)
    Called to batch load the provided keys and return a promise to a list of values.
  • Method Details

    • load

      CompletionStage<List<V>> load(List<K> keys, BatchLoaderEnvironment environment)
      Called to batch load the provided keys and return a promise to a list of values. This default version can be given an environment object to that maybe be useful during the call. A typical use case is passing in security credentials or database details for example.
      Parameters:
      keys - the collection of keys to load
      environment - an environment object that can help with the call
      Returns:
      a promise of the values for those keys