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 org.springframework.graphql.data.method.HandlerMethod
HandlerMethod.HandlerMethodParameter
-
Field Summary
Fields inherited from class org.springframework.graphql.data.method.HandlerMethod
logger
-
Constructor Summary
-
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> 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 org.springframework.graphql.data.method.InvocableHandlerMethodSupport
doInvoke, toArgsMono
Methods inherited from class org.springframework.graphql.data.method.HandlerMethod
assertTargetBean, createWithResolvedBean, equals, findProvidedArgument, formatArgumentError, formatInvokeError, getBean, getBeanType, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, getReturnValueType, getShortLogMessage, hashCode, hasMethodAnnotation, isVoid, toString
-
Constructor Details
-
BatchLoaderHandlerMethod
-
-
Method Details
-
invokeForMap
@Nullable public <K,V> 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
Mono
with 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
Flux
of values.
-