@@ -31,22 +31,22 @@ public class BatchedExecutionStrategy extends ExecutionStrategy {
3131
3232 @ Override
3333 public ExecutionResult execute (ExecutionContext executionContext , GraphQLObjectType parentType , Object source , Map <String , List <Field >> fields ) {
34- return execute (executionContext , new GraphqlExecutionNode (parentType , fields ,
35- Collections .singletonList (new GraphqlExecutionNodeDatum (new LinkedHashMap <String , Object >(), source ))));
34+ return execute (executionContext , new GraphqlExecutionNode2 (parentType , fields ,
35+ Collections .singletonList (new GraphqlExecutionNodeDatum22 (new LinkedHashMap <String , Object >(), source ))));
3636 }
3737
38- private ExecutionResult execute (ExecutionContext executionContext , GraphqlExecutionNode root ) {
38+ private ExecutionResult execute (ExecutionContext executionContext , GraphqlExecutionNode2 root ) {
3939
40- Queue <GraphqlExecutionNode > nodes = new ArrayDeque <>();
40+ Queue <GraphqlExecutionNode2 > nodes = new ArrayDeque <>();
4141 nodes .add (root );
4242
4343 while (!nodes .isEmpty ()) {
4444
45- GraphqlExecutionNode node = nodes .poll ();
45+ GraphqlExecutionNode2 node = nodes .poll ();
4646
4747 for (String fieldName : node .getFields ().keySet ()) {
4848 List <Field > fieldList = node .getFields ().get (fieldName );
49- List <GraphqlExecutionNode > childNodes = resolveField (executionContext , node .getParentType (),
49+ List <GraphqlExecutionNode2 > childNodes = resolveField (executionContext , node .getParentType (),
5050 node .getData (), fieldName , fieldList );
5151 nodes .addAll (childNodes );
5252 }
@@ -55,31 +55,31 @@ private ExecutionResult execute(ExecutionContext executionContext, GraphqlExecut
5555
5656 }
5757
58- private GraphqlExecutionNodeDatum getOnlyElement (List <GraphqlExecutionNodeDatum > list ) {
58+ private GraphqlExecutionNodeDatum22 getOnlyElement (List <GraphqlExecutionNodeDatum22 > list ) {
5959 return list .get (0 );
6060 }
6161
6262 // Use the data.source objects to fetch
6363 // Use the data.parentResult objects to put values into. These are either primatives or empty maps
6464 // If they were empty maps, we need that list of nodes to process
6565
66- private List <GraphqlExecutionNode > resolveField (ExecutionContext executionContext , GraphQLObjectType parentType ,
67- List <GraphqlExecutionNodeDatum > nodeData , String fieldName , List <Field > fields ) {
66+ private List <GraphqlExecutionNode2 > resolveField (ExecutionContext executionContext , GraphQLObjectType parentType ,
67+ List <GraphqlExecutionNodeDatum22 > nodeData , String fieldName , List <Field > fields ) {
6868
6969 GraphQLFieldDefinition fieldDef = getFieldDef (executionContext .getGraphQLSchema (), parentType , fields .get (0 ));
7070 if (fieldDef == null ) {
7171 return Collections .emptyList ();
7272 }
73- List <GraphExecutionNodeValue > values = fetchData (executionContext , parentType , nodeData , fields , fieldDef );
73+ List <GraphQLExecutionNodeValue > values = fetchData (executionContext , parentType , nodeData , fields , fieldDef );
7474
7575 return completeValues (executionContext , parentType , values , fieldName , fields , fieldDef .getType ());
7676 }
7777
7878 /**
7979 * Updates parents and returns new Nodes.
8080 */
81- private List <GraphqlExecutionNode > completeValues (ExecutionContext executionContext , GraphQLObjectType parentType ,
82- List <GraphExecutionNodeValue > values , String fieldName , List <Field > fields ,
81+ private List <GraphqlExecutionNode2 > completeValues (ExecutionContext executionContext , GraphQLObjectType parentType ,
82+ List <GraphQLExecutionNodeValue > values , String fieldName , List <Field > fields ,
8383 GraphQLOutputType outputType ) {
8484
8585 GraphQLType fieldType = handleNonNullType (outputType , values , parentType , fields );
@@ -97,20 +97,20 @@ private List<GraphqlExecutionNode> completeValues(ExecutionContext executionCont
9797 }
9898
9999 @ SuppressWarnings ("unchecked" )
100- private List <GraphqlExecutionNode > handleList (ExecutionContext executionContext ,
101- List <GraphExecutionNodeValue > values , String fieldName , List <Field > fields ,
100+ private List <GraphqlExecutionNode2 > handleList (ExecutionContext executionContext ,
101+ List <GraphQLExecutionNodeValue > values , String fieldName , List <Field > fields ,
102102 GraphQLObjectType parentType , GraphQLList listType ) {
103103
104- List <GraphExecutionNodeValue > flattenedNodeValues = new ArrayList <>();
104+ List <GraphQLExecutionNodeValue > flattenedNodeValues = new ArrayList <>();
105105
106- for (GraphExecutionNodeValue value : values ) {
106+ for (GraphQLExecutionNodeValue value : values ) {
107107 if (value .getValue () == null ) {
108108 value .getResultContainer ().putResult (fieldName , null );
109109 } else {
110- GraphqlExecutionResultList flattenedDatum = value .getResultContainer ().createAndPutEmptyChildList (
110+ GraphqlExecutionResultList2 flattenedDatum = value .getResultContainer ().createAndPutEmptyChildList (
111111 fieldName );
112112 for (Object rawValue : (List <Object >) value .getValue ()) {
113- flattenedNodeValues .add (new GraphExecutionNodeValue (flattenedDatum , rawValue ));
113+ flattenedNodeValues .add (new GraphQLExecutionNodeValue (flattenedDatum , rawValue ));
114114 }
115115 }
116116 }
@@ -120,49 +120,49 @@ private List<GraphqlExecutionNode> handleList(ExecutionContext executionContext,
120120
121121 }
122122
123- private List <GraphqlExecutionNode > handleObject (ExecutionContext executionContext ,
124- List <GraphExecutionNodeValue > values , String fieldName , List <Field > fields , GraphQLType fieldType ) {
123+ private List <GraphqlExecutionNode2 > handleObject (ExecutionContext executionContext ,
124+ List <GraphQLExecutionNodeValue > values , String fieldName , List <Field > fields , GraphQLType fieldType ) {
125125
126126 ChildDataCollector collector = createAndPopulateChildData (values , fieldName , fieldType );
127127
128- List <GraphqlExecutionNode > childNodes =
128+ List <GraphqlExecutionNode2 > childNodes =
129129 createChildNodes (executionContext , fields , collector );
130130
131131 return childNodes ;
132132 }
133133
134- private List <GraphqlExecutionNode > createChildNodes (ExecutionContext executionContext , List <Field > fields ,
134+ private List <GraphqlExecutionNode2 > createChildNodes (ExecutionContext executionContext , List <Field > fields ,
135135 ChildDataCollector collector ) {
136136
137- List <GraphqlExecutionNode > childNodes = new ArrayList <>();
137+ List <GraphqlExecutionNode2 > childNodes = new ArrayList <>();
138138
139139 for (ChildDataCollector .Entry entry : collector .getEntries ()) {
140140 Map <String , List <Field >> childFields = getChildFields (executionContext , entry .getObjectType (), fields );
141- childNodes .add (new GraphqlExecutionNode (entry .getObjectType (), childFields , entry .getData ()));
141+ childNodes .add (new GraphqlExecutionNode2 (entry .getObjectType (), childFields , entry .getData ()));
142142 }
143143 return childNodes ;
144144 }
145145
146- private ChildDataCollector createAndPopulateChildData (List <GraphExecutionNodeValue > values , String fieldName ,
146+ private ChildDataCollector createAndPopulateChildData (List <GraphQLExecutionNodeValue > values , String fieldName ,
147147 GraphQLType fieldType ) {
148148 ChildDataCollector collector = new ChildDataCollector ();
149- for (GraphExecutionNodeValue value : values ) {
149+ for (GraphQLExecutionNodeValue value : values ) {
150150 if (value .getValue () == null ) {
151151 // We hit a null, insert the null and do not create a child
152152 value .getResultContainer ().putResult (fieldName , null );
153153 } else {
154- GraphqlExecutionNodeDatum childDatum = value .getResultContainer ().createAndPutChildDatum (fieldName , value .getValue ());
154+ GraphqlExecutionNodeDatum22 childDatum = value .getResultContainer ().createAndPutChildDatum (fieldName , value .getValue ());
155155 GraphQLObjectType graphQLObjectType = getGraphQLObjectType (fieldType , value .getValue ());
156156 collector .putChildData (graphQLObjectType , childDatum );
157157 }
158158 }
159159 return collector ;
160160 }
161161
162- private GraphQLType handleNonNullType (GraphQLType fieldType , List <GraphExecutionNodeValue > values ,
162+ private GraphQLType handleNonNullType (GraphQLType fieldType , List <GraphQLExecutionNodeValue > values ,
163163 /*Nullable*/ GraphQLObjectType parentType , /*Nullable*/ List <Field > fields ) {
164164 if (isNonNull (fieldType )) {
165- for (GraphExecutionNodeValue value : values ) {
165+ for (GraphQLExecutionNodeValue value : values ) {
166166 if (value .getValue () == null ) {
167167 throw new GraphQLException ("Found null value for non-null type with parent: '"
168168 + parentType .getName () + "' for fields: " + fields );
@@ -203,9 +203,9 @@ private GraphQLObjectType getGraphQLObjectType(GraphQLType fieldType, Object val
203203 return resolvedType ;
204204 }
205205
206- private void handlePrimitives (List <GraphExecutionNodeValue > values , String fieldName ,
206+ private void handlePrimitives (List <GraphQLExecutionNodeValue > values , String fieldName ,
207207 GraphQLType type ) {
208- for (GraphExecutionNodeValue value : values ) {
208+ for (GraphQLExecutionNodeValue value : values ) {
209209 Object coercedValue = coerce (type , value .getValue ());
210210 value .getResultContainer ().putResult (fieldName , coercedValue );
211211 }
@@ -234,13 +234,13 @@ private boolean isObject(GraphQLType type) {
234234 }
235235
236236 @ SuppressWarnings ("unchecked" )
237- private List <GraphExecutionNodeValue > fetchData (ExecutionContext executionContext , GraphQLObjectType parentType ,
238- List <GraphqlExecutionNodeDatum > nodeData , List <Field > fields , GraphQLFieldDefinition fieldDef ) {
237+ private List <GraphQLExecutionNodeValue > fetchData (ExecutionContext executionContext , GraphQLObjectType parentType ,
238+ List <GraphqlExecutionNodeDatum22 > nodeData , List <Field > fields , GraphQLFieldDefinition fieldDef ) {
239239
240240 Map <String , Object > argumentValues = valuesResolver .getArgumentValues (
241241 fieldDef .getArguments (), fields .get (0 ).getArguments (), executionContext .getVariables ());
242242 List <Object > sources = new ArrayList <>();
243- for (GraphqlExecutionNodeDatum n : nodeData ) {
243+ for (GraphqlExecutionNodeDatum22 n : nodeData ) {
244244 sources .add (n .getSource ());
245245 }
246246 DataFetchingEnvironment environment = new DataFetchingEnvironment (
@@ -266,9 +266,9 @@ private List<GraphExecutionNodeValue> fetchData(ExecutionContext executionContex
266266 }
267267 assert nodeData .size () == values .size ();
268268
269- List <GraphExecutionNodeValue > retVal = new ArrayList <>();
269+ List <GraphQLExecutionNodeValue > retVal = new ArrayList <>();
270270 for (int i = 0 ; i < nodeData .size (); i ++) {
271- retVal .add (new GraphExecutionNodeValue (nodeData .get (i ), values .get (i )));
271+ retVal .add (new GraphQLExecutionNodeValue (nodeData .get (i ), values .get (i )));
272272 }
273273 return retVal ;
274274 }
0 commit comments