Package graphql.annotations.dataFetchers
Class MethodDataFetcher<T>
- java.lang.Object
-
- graphql.annotations.dataFetchers.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`
-
-
Constructor Summary
Constructors Constructor Description MethodDataFetcher(java.lang.reflect.Method method, TypeFunction typeFunction, ProcessingElementsContainer container)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tget(graphql.schema.DataFetchingEnvironment environment)
-
-
-
Constructor Detail
-
MethodDataFetcher
public MethodDataFetcher(java.lang.reflect.Method method, TypeFunction typeFunction, ProcessingElementsContainer container)
-
-