public interface BatchLoaderRegistry extends DataLoaderRegistrar
At request time, each function is registered as a
DataLoader in the DataLoaderRegistry
and can be accessed in the data layer to load related entities while avoiding
the N+1 select problem.
BatchLoader,
MappedBatchLoader,
DataLoader| Modifier and Type | Interface and Description |
|---|---|
static interface |
BatchLoaderRegistry.RegistrationSpec<K,V>
Spec to complete the registration of a batch loading function.
|
| Modifier and Type | Method and Description |
|---|---|
<K,V> BatchLoaderRegistry.RegistrationSpec<K,V> |
forName(String name)
Begin the registration of a new batch load function by specifying the
name for the
DataLoader. |
<K,V> BatchLoaderRegistry.RegistrationSpec<K,V> |
forTypePair(Class<K> keyType,
Class<V> valueType)
Begin the registration of a new batch load function by specifying the
types of the keys and values that will be used as input and output.
|
registerDataLoaders<K,V> BatchLoaderRegistry.RegistrationSpec<K,V> forTypePair(Class<K> keyType, Class<V> valueType)
When this method is used, the name for the
DataLoader is automatically set as defined in
BatchLoaderRegistry.RegistrationSpec.withName(String), and likewise,
@SchemaMapping handler methods can transparenly locate and
inject a DataLoader<T> argument based on the generic type
<T>.
K - the key typeV - the value typekeyType - the type of keys that will be used as inputvalueType - the type of value that will be returned as output<K,V> BatchLoaderRegistry.RegistrationSpec<K,V> forName(String name)
DataLoader.
Note: when this method is used, the parameter name
of a DataLoader<T> argument in a @SchemaMapping handler
method needs to match the name given here.
K - the type of keys that will be used as inputV - the type of values that will be used as outputname - the name to use to register a DataLoader