Class BatchLoaderHandlerMethod
java.lang.Object
org.springframework.graphql.data.method.HandlerMethod
org.springframework.graphql.data.method.InvocableHandlerMethodSupport
org.springframework.graphql.data.method.annotation.support.BatchLoaderHandlerMethod
An extension of
HandlerMethod for annotated handler methods adapted to
BatchLoaderWithContext or
MappedBatchLoaderWithContext with the list of keys and
BatchLoaderEnvironment as their input.- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Nested classes/interfaces inherited from class HandlerMethod
HandlerMethod.HandlerMethodParameter -
Field Summary
Fields inherited from class HandlerMethod
logger -
Constructor Summary
ConstructorsConstructorDescriptionBatchLoaderHandlerMethod(HandlerMethod handlerMethod, @Nullable Executor executor) Deprecated, for removal: This API element is subject to removal in a future version.in favor of alternative constructorBatchLoaderHandlerMethod(HandlerMethod handlerMethod, @Nullable Executor executor, boolean invokeAsync) Create an instance. -
Method Summary
Modifier and TypeMethodDescription<V> reactor.core.publisher.Flux<V> invokeForIterable(Collection<?> keys, org.dataloader.BatchLoaderEnvironment environment) Invoke the underlying batch loader method with a collection of input keys to return a collection of matching values.<K,V> @Nullable reactor.core.publisher.Mono <Map<K, V>> invokeForMap(Collection<K> keys, org.dataloader.BatchLoaderEnvironment environment) Invoke the underlying batch loader method with a collection of keys to return a Map of key-value pairs.Methods inherited from class InvocableHandlerMethodSupport
doInvoke, toArgsMonoMethods inherited from class HandlerMethod
assertTargetBean, createWithResolvedBean, equals, findProvidedArgument, formatArgumentError, formatInvokeError, getBean, getBeanType, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, getReturnValueType, getShortLogMessage, hashCode, hasMethodAnnotation, isVoid, toString
-
Constructor Details
-
BatchLoaderHandlerMethod
@Deprecated(since="1.3.0", forRemoval=true) public BatchLoaderHandlerMethod(HandlerMethod handlerMethod, @Nullable Executor executor) Deprecated, for removal: This API element is subject to removal in a future version.in favor of alternative constructorCreate an instance. -
BatchLoaderHandlerMethod
public BatchLoaderHandlerMethod(HandlerMethod handlerMethod, @Nullable Executor executor, boolean invokeAsync) Create an instance.
-
-
Method Details
-
invokeForMap
public <K,V> @Nullable reactor.core.publisher.Mono<Map<K,V>> invokeForMap(Collection<K> keys, org.dataloader.BatchLoaderEnvironment environment) Invoke the underlying batch loader method with a collection of keys to return a Map of key-value pairs.- Type Parameters:
K- the type of keys in the mapV- the type of values in the map- Parameters:
keys- the keys for which to load valuesenvironment- the environment available to batch loaders- Returns:
- a
Monowith map of key-value pairs.
-
invokeForIterable
public <V> reactor.core.publisher.Flux<V> invokeForIterable(Collection<?> keys, org.dataloader.BatchLoaderEnvironment environment) Invoke the underlying batch loader method with a collection of input keys to return a collection of matching values.- Type Parameters:
V- the type of values returned- Parameters:
keys- the keys for which to load valuesenvironment- the environment available to batch loaders- Returns:
- a
Fluxof values.
-