All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.graphql_java_generator.server.util.BatchLoaderDelegate Maven / Gradle / Ivy

There is a newer version: 1.18
Show newest version
/** Generated by the default template from graphql-java-generator */
package com.graphql_java_generator.server.util;

import org.dataloader.BatchLoader;
import org.dataloader.DataLoaderRegistry;
import org.springframework.stereotype.Component;

/**
 * BatchLoaderDelegate is the interface that identifies Spring Beans that help using
 * graphql-java java-dataloader. All the
 * BatchLoaderDelegates are stored in a {@link DataLoaderRegistry}. It's actually a map, in which the key is the name
 * for this BatchLoadeDelegate, as returned by {@link #getName()}. 
* All BatchLoaderDelegates must be defined as Spring Bean, that is: they must be marked by the {@link 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 {@link Component} annotation. You just have to check that its name is unique. * *

* Note: there are two interfaces. The {@link BatchLoaderDelegate#load(java.util.List)} doesn't provide the context. The * {@link BatchLoaderDelegateWithContext#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 * */ public interface BatchLoaderDelegate extends BatchLoader { /** * The name of this BatchLoaderDelegate, as can be retrieved from the {@link DataLoaderRegistry}. * * @return The (must be) unique name of this BatchLoaderDelegate */ public String getName(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy