Class FieldDataFetcher<T>

java.lang.Object
io.smallrye.graphql.execution.datafetcher.FieldDataFetcher<T>
Type Parameters:
T -
All Implemented Interfaces:
graphql.schema.DataFetcher<T>, graphql.TrivialDataFetcher<T>, PlugableDataFetcher<T>

public class FieldDataFetcher<T> extends Object implements PlugableDataFetcher<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 Summary

    Constructors
    Constructor
    Description
    FieldDataFetcher(io.smallrye.graphql.schema.model.Field field, io.smallrye.graphql.schema.model.Type type, io.smallrye.graphql.schema.model.Reference owner)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    get(graphql.schema.DataFetchingEnvironment dfe)
     

    Methods inherited from class java.lang.Object

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

    • FieldDataFetcher

      public FieldDataFetcher(io.smallrye.graphql.schema.model.Field field, io.smallrye.graphql.schema.model.Type type, io.smallrye.graphql.schema.model.Reference owner)
  • Method Details

    • get

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