99import graphql .execution .ExecutionId ;
1010import graphql .execution .ExecutionIdProvider ;
1111import graphql .execution .ExecutionStrategy ;
12+ import graphql .execution .ResponseMapFactory ;
1213import graphql .execution .SimpleDataFetcherExceptionHandler ;
1314import graphql .execution .SubscriptionExecutionStrategy ;
1415import graphql .execution .ValueUnboxer ;
@@ -92,6 +93,7 @@ public class GraphQL {
9293 private final Instrumentation instrumentation ;
9394 private final PreparsedDocumentProvider preparsedDocumentProvider ;
9495 private final ValueUnboxer valueUnboxer ;
96+ private final ResponseMapFactory responseMapFactory ;
9597 private final boolean doNotAutomaticallyDispatchDataLoader ;
9698
9799
@@ -104,6 +106,7 @@ private GraphQL(Builder builder) {
104106 this .instrumentation = assertNotNull (builder .instrumentation , () -> "instrumentation must not be null" );
105107 this .preparsedDocumentProvider = assertNotNull (builder .preparsedDocumentProvider , () -> "preparsedDocumentProvider must be non null" );
106108 this .valueUnboxer = assertNotNull (builder .valueUnboxer , () -> "valueUnboxer must not be null" );
109+ this .responseMapFactory = assertNotNull (builder .responseMapFactory , () -> "responseMapFactory must be not null" );
107110 this .doNotAutomaticallyDispatchDataLoader = builder .doNotAutomaticallyDispatchDataLoader ;
108111 }
109112
@@ -213,7 +216,7 @@ public static class Builder {
213216 private PreparsedDocumentProvider preparsedDocumentProvider = NoOpPreparsedDocumentProvider .INSTANCE ;
214217 private boolean doNotAutomaticallyDispatchDataLoader = false ;
215218 private ValueUnboxer valueUnboxer = ValueUnboxer .DEFAULT ;
216-
219+ private ResponseMapFactory responseMapFactory = ResponseMapFactory . DEFAULT ;
217220
218221 public Builder (GraphQLSchema graphQLSchema ) {
219222 this .graphQLSchema = graphQLSchema ;
@@ -284,6 +287,11 @@ public Builder valueUnboxer(ValueUnboxer valueUnboxer) {
284287 return this ;
285288 }
286289
290+ public Builder mapFactory (ResponseMapFactory responseMapFactory ) {
291+ this .responseMapFactory = responseMapFactory ;
292+ return this ;
293+ }
294+
287295 public GraphQL build () {
288296 // we use the data fetcher exception handler unless they set their own strategy in which case bets are off
289297 if (queryExecutionStrategy == null ) {
@@ -543,7 +551,7 @@ private CompletableFuture<ExecutionResult> execute(ExecutionInput executionInput
543551 EngineRunningState engineRunningState
544552 ) {
545553
546- Execution execution = new Execution (queryStrategy , mutationStrategy , subscriptionStrategy , instrumentation , valueUnboxer , doNotAutomaticallyDispatchDataLoader );
554+ Execution execution = new Execution (queryStrategy , mutationStrategy , subscriptionStrategy , instrumentation , valueUnboxer , responseMapFactory , doNotAutomaticallyDispatchDataLoader );
547555 ExecutionId executionId = executionInput .getExecutionId ();
548556
549557 return execution .execute (document , graphQLSchema , executionId , executionInput , instrumentationState , engineRunningState );
0 commit comments