Class DataFetcherHandlerMethod
java.lang.Object
org.springframework.graphql.data.method.HandlerMethod
org.springframework.graphql.data.method.InvocableHandlerMethodSupport
org.springframework.graphql.data.method.annotation.support.DataFetcherHandlerMethod
An extension of
HandlerMethod for annotated handler methods adapted
to DataFetcher with DataFetchingEnvironment
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
ConstructorsConstructorDescriptionDataFetcherHandlerMethod(HandlerMethod handlerMethod, HandlerMethodArgumentResolverComposite resolvers, Consumer<Object[]> validationHelper, Executor executor, boolean subscription) Constructor with a parent handler method. -
Method Summary
Modifier and TypeMethodDescriptionReturn the configured argument resolvers.invoke(DataFetchingEnvironment environment) Invoke the method after resolving its argument values in the context of the givenDataFetchingEnvironment.Methods inherited from class org.springframework.graphql.data.method.InvocableHandlerMethodSupport
doInvoke, toArgsMonoMethods 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
public DataFetcherHandlerMethod(HandlerMethod handlerMethod, HandlerMethodArgumentResolverComposite resolvers, @Nullable Consumer<Object[]> validationHelper, @Nullable Executor executor, boolean subscription) Constructor with a parent handler method.- Parameters:
handlerMethod- the handler methodresolvers- the argument resolversvalidationHelper- to apply bean validation withsubscription- whether the field being fetched is of subscription type
-
-
Method Details
-
getResolvers
Return the configured argument resolvers. -
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 GraphQLDataFetchingEnvironmentto use to resolve arguments.- Returns:
- the raw value returned by the invoked method, possibly a
Monoin case a method argument requires asynchronous resolution;Mono<Throwableis returned if invocation fails.
-