Class BatchLoaderDelegateTFoo3Impl

java.lang.Object
org.allGraphQLCases.server.util.BatchLoaderDelegateTFoo3Impl
All Implemented Interfaces:
BatchLoaderDelegateWithContext<UUID,​TFoo3>, org.dataloader.BatchLoaderWithContext<UUID,​TFoo3>

@Component
public class BatchLoaderDelegateTFoo3Impl
extends Object
implements BatchLoaderDelegateWithContext<UUID,​TFoo3>
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 :
 @Override
 public CompletableFuture> friends(DataFetchingEnvironment environment, DataLoader dataLoader,
                TFoo3 source) {
        logger.debug("Executing characterImpl.friends, with this character: {}", source.getId().toString());
        List friendIds = graphQLUtil
                        .convertListByteArrayToList(characterRepository.findFriendsId(source.getId()));
        return dataLoader.loadMany(friendIds);
 }

 
Author:
generated by graphql-java-generator
  • Constructor Details

  • Method Details

    • load

      public CompletionStage<List<TFoo3>> 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,​TFoo3>
      Parameters:
      keys - the list of keys, for which we want to retrieve the instances.
      Returns:
      the list of TFoo3s 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,​TFoo3>