.transform(builder -> builder.field(currentField).path(fieldPath).parent(parameters));
.transform(builder -> builder.field(currentField).path(fieldPath));
@Override @SuppressWarnings({"TypeParameterUnusedInFormals","FutureReturnValueIgnored"}) public CompletableFuture<ExecutionResult> execute(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException { Instrumentation instrumentation = executionContext.getInstrumentation(); InstrumentationExecutionStrategyParameters instrumentationParameters = new InstrumentationExecutionStrategyParameters(executionContext, parameters); InstrumentationContext<ExecutionResult> executionStrategyCtx = instrumentation.beginExecutionStrategy(instrumentationParameters); MergedSelectionSet fields = parameters.getFields(); List<String> fieldNames = new ArrayList<>(fields.keySet()); CompletableFuture<List<ExecutionResult>> resultsFuture = Async.eachSequentially(fieldNames, (fieldName, index, prevResults) -> { MergedField currentField = fields.getSubField(fieldName); ExecutionPath fieldPath = parameters.getPath().segment(mkNameForPath(currentField)); ExecutionStrategyParameters newParameters = parameters .transform(builder -> builder.field(currentField).path(fieldPath)); return resolveField(executionContext, newParameters); }); CompletableFuture<ExecutionResult> overallResult = new CompletableFuture<>(); executionStrategyCtx.onDispatched(overallResult); resultsFuture.whenComplete(handleResults(executionContext, fieldNames, overallResult)); overallResult.whenComplete(executionStrategyCtx::onCompleted); return overallResult; }
.fields(fields) .nonNullFieldValidator(nonNullableFieldValidator) .path(path) .build();
.listSize(values.size()) .currentListIndex(finalIndex) .path(indexedPath) .source(item) );
.path(fieldPath) .field(currentField) .executionStepInfo(executionStepInfo)
.transform(builder -> builder.field(currentField).path(fieldPath));
.transform(builder -> builder.field(currentField).path(fieldPath).parent(parameters));
@Override @SuppressWarnings({"TypeParameterUnusedInFormals","FutureReturnValueIgnored"}) public CompletableFuture<ExecutionResult> execute(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException { Instrumentation instrumentation = executionContext.getInstrumentation(); InstrumentationExecutionStrategyParameters instrumentationParameters = new InstrumentationExecutionStrategyParameters(executionContext, parameters); InstrumentationContext<ExecutionResult> executionStrategyCtx = instrumentation.beginExecutionStrategy(instrumentationParameters); MergedSelectionSet fields = parameters.getFields(); List<String> fieldNames = new ArrayList<>(fields.keySet()); CompletableFuture<List<ExecutionResult>> resultsFuture = Async.eachSequentially(fieldNames, (fieldName, index, prevResults) -> { MergedField currentField = fields.getSubField(fieldName); ExecutionPath fieldPath = parameters.getPath().segment(mkNameForPath(currentField)); ExecutionStrategyParameters newParameters = parameters .transform(builder -> builder.field(currentField).path(fieldPath)); return resolveField(executionContext, newParameters); }); CompletableFuture<ExecutionResult> overallResult = new CompletableFuture<>(); executionStrategyCtx.onDispatched(overallResult); resultsFuture.whenComplete(handleResults(executionContext, fieldNames, overallResult)); overallResult.whenComplete(executionStrategyCtx::onCompleted); return overallResult; }
private ExecutionStrategyParameters firstFieldOfSubscriptionSelection(ExecutionStrategyParameters parameters) { MergedSelectionSet fields = parameters.getFields(); MergedField firstField = fields.getSubField(fields.getKeys().get(0)); ExecutionPath fieldPath = parameters.getPath().segment(mkNameForPath(firstField.getSingleField())); return parameters.transform(builder -> builder.field(firstField).path(fieldPath)); }
.listSize(values.size()) .currentListIndex(finalIndex) .path(indexedPath) .source(item) );
.fields(fields) .nonNullFieldValidator(nonNullableFieldValidator) .path(path) .build();
.path(fieldPath) .field(currentField) .executionStepInfo(executionStepInfo)
@Override public CompletableFuture<ExecutionResult> execute(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException { MergedSelectionSet fields = parameters.getFields(); Map<String, FetchedValue> fetchedValues = new LinkedHashMap<>(); // first fetch every value for (String fieldName : fields.keySet()) { FetchedValue fetchedValue = fetchField(executionContext, parameters, fields, fieldName); fetchedValues.put(fieldName, fetchedValue); } // then for every fetched value, complete it Map<String, Object> results = new LinkedHashMap<>(); for (String fieldName : fetchedValues.keySet()) { MergedField currentField = fields.getSubField(fieldName); FetchedValue fetchedValue = fetchedValues.get(fieldName); ExecutionPath fieldPath = parameters.getPath().segment(fieldName); ExecutionStrategyParameters newParameters = parameters .transform(builder -> builder.field(currentField).path(fieldPath)); try { completeValue(executionContext, results, fieldName, fetchedValue, newParameters); } catch (NonNullableFieldWasNullException e) { assertNonNullFieldPrecondition(e); results = null; break; } } return CompletableFuture.completedFuture(new ExecutionResultImpl(results, executionContext.getErrors())); }
private ExecutionStrategyParameters firstFieldOfSubscriptionSelection(ExecutionStrategyParameters parameters) { MergedSelectionSet fields = parameters.getFields(); MergedField firstField = fields.getSubField(fields.getKeys().get(0)); ExecutionPath fieldPath = parameters.getPath().segment(mkNameForPath(firstField.getSingleField())); return parameters.transform(builder -> builder.field(firstField).path(fieldPath)); }
private FetchedValue fetchField(ExecutionContext executionContext, ExecutionStrategyParameters parameters, MergedSelectionSet fields, String fieldName) { MergedField currentField = fields.getSubField(fieldName); ExecutionPath fieldPath = parameters.getPath().segment(fieldName); ExecutionStrategyParameters newParameters = parameters .transform(builder -> builder.field(currentField).path(fieldPath)); return fetchField(executionContext, newParameters).join(); }
private ExecutionStrategyParameters newParameters(ExecutionStrategyParameters parameters, MergedSelectionSet fields, String fieldName) { MergedField currentField = fields.getSubField(fieldName); ExecutionPath fieldPath = parameters.getPath().segment(fieldName); return parameters .transform(builder -> builder.field(currentField).path(fieldPath)); }