Class DataFetcherHandlerMethod


public class DataFetcherHandlerMethod extends DataFetcherHandlerMethodSupport
Invocable handler to use as a DataFetcher.
Since:
1.0.0
Author:
Rossen Stoyanchev
  • 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 constructor
      Constructor with a parent handler method.
      Parameters:
      handlerMethod - the handler method
      resolvers - the argument resolvers
      validationHelper - to apply bean validation with
      executor - an Executor to use for Callable return values
      subscription - whether the field being fetched is of subscription type
    • 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 method
      resolvers - the argument resolvers
      validationHelper - to apply bean validation with
      executor - an Executor to use for Callable return values
      subscription - whether the field being fetched is of subscription type
      invokeAsync - whether to invoke the method through the Executor
      Since:
      1.3.0
  • Method Details

    • invoke

      @Nullable public Object invoke(DataFetchingEnvironment environment)
      Invoke the method after resolving its argument values in the context of the given DataFetchingEnvironment.

      Argument values are commonly resolved through HandlerMethodArgumentResolvers. The providedArgs 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

      @Nullable public Object invoke(DataFetchingEnvironment environment, Object... providedArgs)
      Variant of invoke(DataFetchingEnvironment) that also accepts "given" arguments, which are matched by type.
      Parameters:
      environment - the data fetching environment
      providedArgs - additional arguments to be matched by their type
      Since:
      1.2.0