Class FieldDataFetcher<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    graphql.schema.DataFetcher<T>, graphql.TrivialDataFetcher<T>

    public class FieldDataFetcher<T>
    extends Object
    implements graphql.schema.DataFetcher<T>, graphql.TrivialDataFetcher<T>
    Custom property data fetcher to allow arbitrary method names (instead of getters/setters) and to intercept the result for some manipulation.

    Implementation Note:
    If the (graphql-) field has no methodName, a FieldDataFetcher.FieldAccessor for the (java-) field is is created. Otherwise, a FieldDataFetcher.MethodAccessor is created for the accessor method.

    The owner is used to create the FieldDataFetcher.PropertyAccessor independently of the source object (which could be a different subtype of the owner class for each call).

    • Constructor Detail

      • FieldDataFetcher

        public FieldDataFetcher​(Field field,
                                Type type,
                                Reference owner)
    • Method Detail

      • get

        public T get​(graphql.schema.DataFetchingEnvironment dfe)
              throws Exception
        Specified by:
        get in interface graphql.schema.DataFetcher<T>
        Throws:
        Exception