Class FunctionDataFetcher

  • All Implemented Interfaces:
    graphql.schema.DataFetcher

    
    public class FunctionDataFetcher
     implements DataFetcher<Any>
                        

    Simple DataFetcher that invokes target function on the given object.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Object get(DataFetchingEnvironment environment) Invoke a suspend function or blocking function, passing in the target if not null or default to using the source from the environment.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FunctionDataFetcher

        FunctionDataFetcher(Object target, KFunction<?> fn)
        Parameters:
        target - The target object that performs the data fetching, if not specified then this data fetcher will attempt to use source object from the environment
        fn - The Kotlin function being invoked
    • Method Detail

      • get

         Object get(DataFetchingEnvironment environment)

        Invoke a suspend function or blocking function, passing in the target if not null or default to using the source from the environment.