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, BiConsumer<Object, 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
.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.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
public DataFetcherHandlerMethod(HandlerMethod handlerMethod, HandlerMethodArgumentResolverComposite resolvers, @Nullable BiConsumer<Object, 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
. 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.- Since:
- 1.2
-