Interface BatchLoaderDelegate<K,V>

All Superinterfaces:
org.dataloader.BatchLoader<K,V>

public interface BatchLoaderDelegate<K,V> extends org.dataloader.BatchLoader<K,V>
BatchLoaderDelegate is the interface that identifies Spring Beans that help using graphql-java java-dataloader. All the BatchLoaderDelegates are stored in a DataLoaderRegistry. It's actually a map, in which the key is the name for this BatchLoadeDelegate, as returned by getName().
All BatchLoaderDelegates must be defined as Spring Bean, that is: they must be marked by the Component annotation. They are discovered by the GraphQLProvider.dataLoaderRegistry() method.
It is not allowed to have two BatchLoaderDelegates with the same name.
graphql-java-generator will generate one BatchLoaderDelegate implementation for each object defined in the GrapQL schema, which has an ID as a field.
You can register your own BatchDataLoader, by just creating a class which implements BatchLoaderDelegate, and mark it as a Spring Bean with the Component annotation. You just have to check that its name is unique. *

Note: there are two interfaces. The BatchLoader.load(java.util.List) doesn't provide the context. The BatchLoaderWithContext.load(java.util.List, org.dataloader.BatchLoaderEnvironment) provides the context. You can choose between both at code generation time, with the use of the generateBatchLoaderEnvironment plugin parameter

Author:
etienne-sf
  • Method Summary

    Modifier and Type
    Method
    Description
    The name of this BatchLoaderDelegate, as can be retrieved from the DataLoaderRegistry.

    Methods inherited from interface org.dataloader.BatchLoader

    load
  • Method Details

    • getName

      String getName()
      The name of this BatchLoaderDelegate, as can be retrieved from the DataLoaderRegistry.
      Returns:
      The (must be) unique name of this BatchLoaderDelegate