Class MethodDataFetcher<T>

  • Type Parameters:
    T - type of the returned value
    All Implemented Interfaces:
    graphql.schema.DataFetcher<T>

    public class MethodDataFetcher<T>
    extends java.lang.Object
    implements graphql.schema.DataFetcher<T>
    This class is determining how to return value of a method from an api entity The order of the mapping: 1. If no source is provided to map between - invoking the method implementation 2. If annotated with @GraphQLInvokeDetached - invoking the method implementation 3. else If source is provided, and method name is matching a method name in the source object - execute source implementation i.e method name is: `name` ; existing method in the source object with name: `name` 4. else If source is provided, and method name is matching a method name with a `get` prefix in the source object - execute source implementation i.e method name is: `name` ; existing method in the source object with name: `getName` 5. else If source is provided, and method name is matching a method name with a `is` prefix in the source object - execute source implementation i.e method name is: `name` ; existing method in the source object with name: isName 6. else If source is provided, and method name is matching a field name in the source object - return field value from the source object i.e method name is: `name` ; field name in source object is: `name` 7. else If source is provided, and method name is prefixed with `get` or `is` - and it matches to a field name (without the prefix) in the source object - return field value from the source object i.e method name is: `getName` ; field name in source object is: `name`
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get​(graphql.schema.DataFetchingEnvironment environment)  
      • Methods inherited from class java.lang.Object

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

      • get

        public T get​(graphql.schema.DataFetchingEnvironment environment)
        Specified by:
        get in interface graphql.schema.DataFetcher<T>