@PublicApi public class FieldDataFetcher<T> extends java.lang.Object implements DataFetcher<T>
Constructor and Description |
---|
FieldDataFetcher(java.lang.String fieldName)
Constructs a new data fetcher that tries to find values from the name field, using
DataFetchingEnvironment.getSource() as the source object. |
Modifier and Type | Method and Description |
---|---|
T |
get(DataFetchingEnvironment environment)
This is called by the graphql engine to fetch the value.
|
public FieldDataFetcher(java.lang.String fieldName)
DataFetchingEnvironment.getSource()
as the source object.fieldName
- The name of the field.public T get(DataFetchingEnvironment environment)
DataFetcher
DataFetchingEnvironment
is a composite
context object that tells you all you need to know about who to fetch a data value in graphql type terms.get
in interface DataFetcher<T>
environment
- this is the data fetching environment which contains all the context you need to fetch a value