@@ -389,7 +389,7 @@ private static Field selectionForNormalizedField(GraphQLSchema schema,
389389 .build ();
390390 }
391391
392- private static @ NotNull List <Directive > buildDirectives (ExecutableNormalizedField executableNormalizedField , QueryDirectives queryDirectives , VariableAccumulator variableAccumulator ) {
392+ private static @ NonNull List <Directive > buildDirectives (ExecutableNormalizedField executableNormalizedField , QueryDirectives queryDirectives , VariableAccumulator variableAccumulator ) {
393393 if (queryDirectives == null || queryDirectives .getImmediateAppliedDirectivesByField ().isEmpty ()) {
394394 return emptyList ();
395395 }
@@ -401,7 +401,7 @@ private static Field selectionForNormalizedField(GraphQLSchema schema,
401401
402402 private static Directive buildDirective (ExecutableNormalizedField executableNormalizedField , QueryDirectives queryDirectives , QueryAppliedDirective queryAppliedDirective , VariableAccumulator variableAccumulator ) {
403403
404- List <Argument > arguments = ArgumentMaker .createDirectiveArguments (executableNormalizedField ,queryDirectives ,queryAppliedDirective , variableAccumulator );
404+ List <Argument > arguments = ArgumentMaker .createDirectiveArguments (executableNormalizedField , queryDirectives , queryAppliedDirective , variableAccumulator );
405405 return Directive .newDirective ()
406406 .name (queryAppliedDirective .getName ())
407407 .arguments (arguments ).build ();
@@ -416,59 +416,6 @@ private static SelectionSet selectionSet(List<Field> fields) {
416416 return newSelectionSet ().selections (fields ).build ();
417417 }
418418
419- private static List <Argument > createArguments (ExecutableNormalizedField executableNormalizedField ,
420- VariableAccumulator variableAccumulator ) {
421- ImmutableList .Builder <Argument > result = ImmutableList .builder ();
422- ImmutableMap <String , NormalizedInputValue > normalizedArguments = executableNormalizedField .getNormalizedArguments ();
423- for (String argName : normalizedArguments .keySet ()) {
424- NormalizedInputValue normalizedInputValue = normalizedArguments .get (argName );
425- Value <?> value = argValue (executableNormalizedField , argName , normalizedInputValue , variableAccumulator );
426- Argument argument = newArgument ()
427- .name (argName )
428- .value (value )
429- .build ();
430- result .add (argument );
431- }
432- return result .build ();
433- }
434-
435- @ SuppressWarnings ("unchecked" )
436- private static Value <?> argValue (ExecutableNormalizedField executableNormalizedField ,
437- String argName ,
438- @ Nullable Object value ,
439- VariableAccumulator variableAccumulator ) {
440- if (value instanceof List ) {
441- ArrayValue .Builder arrayValue = ArrayValue .newArrayValue ();
442- arrayValue .values (map ((List <Object >) value , val -> argValue (executableNormalizedField , argName , val , variableAccumulator )));
443- return arrayValue .build ();
444- }
445- if (value instanceof Map ) {
446- ObjectValue .Builder objectValue = ObjectValue .newObjectValue ();
447- Map <String , Object > map = (Map <String , Object >) value ;
448- for (String fieldName : map .keySet ()) {
449- Value <?> fieldValue = argValue (executableNormalizedField , argName , (NormalizedInputValue ) map .get (fieldName ), variableAccumulator );
450- objectValue .objectField (ObjectField .newObjectField ().name (fieldName ).value (fieldValue ).build ());
451- }
452- return objectValue .build ();
453- }
454- if (value == null ) {
455- return NullValue .newNullValue ().build ();
456- }
457- return (Value <?>) value ;
458- }
459-
460- @ NonNull
461- private static Value <?> argValue (ExecutableNormalizedField executableNormalizedField ,
462- String argName ,
463- NormalizedInputValue normalizedInputValue ,
464- VariableAccumulator variableAccumulator ) {
465- if (variableAccumulator .shouldMakeVariable (executableNormalizedField , argName , normalizedInputValue )) {
466- VariableValueWithDefinition variableWithDefinition = variableAccumulator .accumulateVariable (normalizedInputValue );
467- return variableWithDefinition .getVariableReference ();
468- } else {
469- return argValue (executableNormalizedField , argName , normalizedInputValue .getValue (), variableAccumulator );
470- }
471- }
472419
473420 @ NonNull
474421 private static GraphQLFieldDefinition getFieldDefinition (GraphQLSchema schema ,
0 commit comments