File tree Expand file tree Collapse file tree 2 files changed +4
-16
lines changed
Expand file tree Collapse file tree 2 files changed +4
-16
lines changed Original file line number Diff line number Diff line change 77import java .util .ArrayList ;
88import java .util .List ;
99
10+ import static graphql .schema .DataFetchingEnvironmentBuilder .newDataFetchingEnvironment ;
11+
1012/**
1113 * Given a normal data fetcher as a delegate,
1214 * uses that fetcher in a batched context by iterating through each source value and calling
@@ -27,8 +29,8 @@ public Object get(DataFetchingEnvironment environment) {
2729 List <Object > results = new ArrayList <>();
2830 for (Object source : sources ) {
2931
30- DataFetchingEnvironment singleEnv = environment
31- .transform ( builder -> builder . source (source ));
32+ DataFetchingEnvironment singleEnv = newDataFetchingEnvironment ( environment )
33+ .source (source ). build ( );
3234 results .add (delegate .get (singleEnv ));
3335 }
3436 return results ;
Original file line number Diff line number Diff line change @@ -108,18 +108,4 @@ public interface DataFetchingEnvironment {
108108 * @return the {@link DataFetchingFieldSelectionSet} for the current operation
109109 */
110110 DataFetchingFieldSelectionSet getSelectionSet ();
111-
112-
113- /**
114- * This allows you to transform this DataFetchingEnvironment object into another one.
115- *
116- * @param action the action to which a {@link DataFetchingEnvironmentBuilder} is passed
117- *
118- * @return a new transformed DataFetchingEnvironment
119- */
120- default DataFetchingEnvironment transform (Consumer <DataFetchingEnvironmentBuilder > action ) {
121- DataFetchingEnvironmentBuilder builder = newDataFetchingEnvironment (this );
122- action .accept (builder );
123- return builder .build ();
124- }
125111}
You can’t perform that action at this time.
0 commit comments