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 HandlerMethod
HandlerMethod.HandlerMethodParameter -
Field Summary
Fields inherited from class DataFetcherHandlerMethodSupport
resolversFields inherited from class HandlerMethod
logger -
Constructor Summary
ConstructorsConstructorDescriptionDataFetcherHandlerMethod(HandlerMethod handlerMethod, HandlerMethodArgumentResolverComposite resolvers, @Nullable BiConsumer<Object, @Nullable 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 constructorDataFetcherHandlerMethod(HandlerMethod handlerMethod, HandlerMethodArgumentResolverComposite resolvers, @Nullable BiConsumer<Object, @Nullable Object[]> validationHelper, @Nullable Executor executor, boolean invokeAsync, boolean subscription) Constructor with a parent handler method. -
Method Summary
Modifier and TypeMethodDescription@Nullable Objectinvoke(graphql.schema.DataFetchingEnvironment environment) Invoke the method after resolving its argument values in the context of the givenDataFetchingEnvironment.@Nullable ObjectVariant ofinvoke(DataFetchingEnvironment)that also accepts "given" arguments, which are matched by type.Methods inherited from class DataFetcherHandlerMethodSupport
getMethodArgumentValues, getResolversMethods 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
-
DataFetcherHandlerMethod
@Deprecated(since="1.3.0", forRemoval=true) public DataFetcherHandlerMethod(HandlerMethod handlerMethod, HandlerMethodArgumentResolverComposite resolvers, @Nullable BiConsumer<Object, @Nullable 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, @Nullable 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- anExecutorto use forCallablereturn valuesinvokeAsync- whether to invoke the method through the Executorsubscription- whether the field being fetched is of subscription type- 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. TheprovidedArgsparameter 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
Monoin case a method argument requires asynchronous resolution;Mono<Throwable>is returned if invocation fails.
-
invoke
public @Nullable Object invoke(graphql.schema.DataFetchingEnvironment environment, Object... providedArgs) 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
-