Class DataFetcherHandlerMethod
java.lang.Object
org.springframework.graphql.data.method.HandlerMethod
org.springframework.graphql.data.method.InvocableHandlerMethodSupport
org.springframework.graphql.data.method.annotation.support.DataFetcherHandlerMethodSupport
org.springframework.graphql.data.method.annotation.support.DataFetcherHandlerMethod
Invocable handler to use as a
DataFetcher
.- 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.annotation.support.DataFetcherHandlerMethodSupport
resolvers
Fields inherited from class org.springframework.graphql.data.method.HandlerMethod
logger
-
Constructor Summary
ConstructorDescriptionDataFetcherHandlerMethod
(HandlerMethod handlerMethod, HandlerMethodArgumentResolverComposite resolvers, BiConsumer<Object, Object[]> validationHelper, Executor executor, boolean subscription) Deprecated, for removal: This API element is subject to removal in a future version.in favor of alternative constructorDataFetcherHandlerMethod
(HandlerMethod handlerMethod, HandlerMethodArgumentResolverComposite resolvers, BiConsumer<Object, Object[]> validationHelper, Executor executor, boolean invokeAsync, boolean subscription) Constructor with a parent handler method. -
Method Summary
Modifier and TypeMethodDescriptioninvoke
(DataFetchingEnvironment environment) Invoke the method after resolving its argument values in the context of the givenDataFetchingEnvironment
.invoke
(DataFetchingEnvironment environment, Object... providedArgs) Variant ofinvoke(DataFetchingEnvironment)
that also accepts "given" arguments, which are matched by type.Methods inherited from class org.springframework.graphql.data.method.annotation.support.DataFetcherHandlerMethodSupport
getMethodArgumentValues, getResolvers
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
-
DataFetcherHandlerMethod
@Deprecated(since="1.3.0", forRemoval=true) public DataFetcherHandlerMethod(HandlerMethod handlerMethod, HandlerMethodArgumentResolverComposite resolvers, @Nullable BiConsumer<Object, Object[]> validationHelper, @Nullable Executor executor, boolean subscription) Deprecated, for removal: This API element is subject to removal in a future version.in favor of alternative constructorConstructor with a parent handler method. -
DataFetcherHandlerMethod
public DataFetcherHandlerMethod(HandlerMethod handlerMethod, HandlerMethodArgumentResolverComposite resolvers, @Nullable BiConsumer<Object, Object[]> validationHelper, @Nullable Executor executor, boolean invokeAsync, boolean subscription) Constructor with a parent handler method.- Parameters:
handlerMethod
- the handler methodresolvers
- the argument resolversvalidationHelper
- to apply bean validation withexecutor
- anExecutor
to use forCallable
return valuessubscription
- whether the field being fetched is of subscription typeinvokeAsync
- whether to invoke the method through the Executor- Since:
- 1.3.0
-
-
Method Details
-
invoke
Invoke the method after resolving its argument values in the context of the givenDataFetchingEnvironment
.Argument values are commonly resolved through
HandlerMethodArgumentResolvers
. TheprovidedArgs
parameter however may supply argument values to be used directly, i.e. without argument resolution. Provided argument values are checked before argument resolvers.- Parameters:
environment
- the environment to resolve arguments from- Returns:
- the raw value returned by the invoked method, possibly a
Mono
in case a method argument requires asynchronous resolution;Mono<Throwable>
is returned if invocation fails.
-
invoke
Variant ofinvoke(DataFetchingEnvironment)
that also accepts "given" arguments, which are matched by type.- Parameters:
environment
- the data fetching environmentprovidedArgs
- additional arguments to be matched by their type- Since:
- 1.2.0
-