forked from graphql-java/graphql-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataFetcher.java
More file actions
28 lines (24 loc) · 1.08 KB
/
DataFetcher.java
File metadata and controls
28 lines (24 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package graphql.schema;
import graphql.PublicSpi;
/**
* A data fetcher is responsible for returning a data value back for a given graphql field. The graphql engine
* uses data fetchers to resolve / fetch a logical field into a runtime object that will be sent back as part
* of the overall graphql {@link graphql.ExecutionResult}
*
* In other implementations, these are sometimes called "Resolvers" or "Field Resolvers", because that is there function,
* they resolve a logical graphql field into an actual data value.
*
* @param <T> the type of object returned
*/
@PublicSpi
public interface DataFetcher<T> {
/**
* This is called by the graphql engine to fetch the value. The {@link graphql.schema.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.
*
* @param environment this is the data fetching environment which contains all the context you need to fetch a value
*
* @return a value of type T
*/
T get(DataFetchingEnvironment environment);
}