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 aDataLoaderRegistry. It's actually a map, in which the key is the name for this BatchLoadeDelegate, as returned bygetName().
All BatchLoaderDelegates must be defined as Spring Bean, that is: they must be marked by theComponentannotation. 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 theComponentannotation. 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. TheBatchLoaderWithContext.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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetName()The name of this BatchLoaderDelegate, as can be retrieved from theDataLoaderRegistry.
-