Class BatchLoaderDelegatePetImpl

All Implemented Interfaces:
BatchLoaderDelegateWithContext<UUID,​Pet>, org.dataloader.BatchLoaderWithContext<UUID,​Pet>

public class BatchLoaderDelegatePetImpl
extends Object
implements BatchLoaderDelegateWithContext<UUID,​Pet>
This is the default implementation for BathLoaderDelegate. It is implemented for each object of the GraphQL model that has a field of type ID, which is identified as an identifier.
It can be used in a DataFetcherDelegate implementation in this way :
 public CompletableFuture> friends(DataFetchingEnvironment environment, DataLoader dataLoader,
                Pet source) {
        logger.debug("Executing characterImpl.friends, with this character: {}", source.getId().toString());
        List friendIds = graphQLUtil
        return dataLoader.loadMany(friendIds);

generated by graphql-java-generator
  • Constructor Details

  • Method Details

    • load

      public CompletionStage<List<Pet>> load​(List<UUID> keys, org.dataloader.BatchLoaderEnvironment environment)
      A batch loader function that will be called with N or more keys for batch loading. This can be a singleton object since it's stateless.
      Specified by:
      load in interface org.dataloader.BatchLoaderWithContext<UUID,​Pet>
      keys - the list of keys, for which we want to retrieve the instances.
      the list of Pets corresponding to the given keys
    • getName

      public String getName()
      The name for this BatchLoaderDelegate, as ot is stored in the DataLoaderRegistry.
      The BatchLoader can then be retrieved by this command, in a DataFetchDelegate implementation:
      Specified by:
      getName in interface BatchLoaderDelegateWithContext<UUID,​Pet>