Interface BatchLoaderRegistry.RegistrationSpec<K,V> 
- Type Parameters:
- K- the type of the key that identifies the value
- V- the type of the data value
- Enclosing interface:
- BatchLoaderRegistry
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
- 
Method SummaryModifier and TypeMethodDescriptionvoidregisterBatchLoader(BiFunction<List<K>, org.dataloader.BatchLoaderEnvironment, reactor.core.publisher.Flux<V>> loader) Register the given batch loading function.voidregisterMappedBatchLoader(BiFunction<Set<K>, org.dataloader.BatchLoaderEnvironment, reactor.core.publisher.Mono<Map<K, V>>> loader) A variant ofregisterBatchLoader(BiFunction)that returns a Map of key-value pairs, which is useful is there aren't values for all keys.Customize the name under which theDataLoaderis registered and can be accessed in the data layer.withOptions(Consumer<org.dataloader.DataLoaderOptions.Builder> optionsBuilderConsumer) Customize theDataLoaderOptionsto use to create theDataLoaderviaDataLoaderFactory.withOptions(org.dataloader.DataLoaderOptions options) Set theDataLoaderOptionsto use to create theDataLoaderviaDataLoaderFactory.
- 
Method Details- 
withNameCustomize the name under which theDataLoaderis registered and can be accessed in the data layer.By default, this is the full class name of the value type, if the value type is specified via BatchLoaderRegistry.forTypePair(Class, Class).- Parameters:
- name- the name to use
- Returns:
- a spec to complete the registration
 
- 
withOptionsBatchLoaderRegistry.RegistrationSpec<K,V> withOptions(Consumer<org.dataloader.DataLoaderOptions.Builder> optionsBuilderConsumer) Customize theDataLoaderOptionsto use to create theDataLoaderviaDataLoaderFactory.Note: Do not set DataLoaderOptions.Builder.setBatchLoaderContextProvider(BatchLoaderContextProvider)as this will be set later to a provider that returns the context fromExecutionInput.getGraphQLContext(), so that batch loading functions and data fetchers can rely on access to the same context.- Parameters:
- optionsBuilderConsumer- callback to customize the options, invoked immediately and given access to the options builder instance
- Returns:
- a spec to complete the registration
- Since:
- 1.4.0
 
- 
withOptionsSet theDataLoaderOptionsto use to create theDataLoaderviaDataLoaderFactory.Note: Do not set DataLoaderOptions.Builder.setBatchLoaderContextProvider(BatchLoaderContextProvider)as this will be set later to a provider that returns the context fromExecutionInput.getGraphQLContext(), so that batch loading functions and data fetchers can rely on access to the same context.- Parameters:
- options- the options to use
- Returns:
- a spec to complete the registration
 
- 
registerBatchLoadervoid registerBatchLoader(BiFunction<List<K>, org.dataloader.BatchLoaderEnvironment, reactor.core.publisher.Flux<V>> loader) Register the given batch loading function.The values returned from the function must match the order and the number of keys, with nullfor missing values. Please, seeBatchLoader.- Parameters:
- loader- the loader function
- See Also:
 
- 
registerMappedBatchLoadervoid registerMappedBatchLoader(BiFunction<Set<K>, org.dataloader.BatchLoaderEnvironment, reactor.core.publisher.Mono<Map<K, V>>> loader) A variant ofregisterBatchLoader(BiFunction)that returns a Map of key-value pairs, which is useful is there aren't values for all keys. Please seeMappedBatchLoader.- Parameters:
- loader- the loader function
- See Also:
 
 
-