use of graphql.execution.nextgen.result.LeafExecutionResultNode in project graphql-java by graphql-java.
the class ResultNodesCreator method createResultNode.
public ExecutionResultNode createResultNode(FetchedValueAnalysis fetchedValueAnalysis) {
ResolvedValue resolvedValue = createResolvedValue(fetchedValueAnalysis);
ExecutionStepInfo executionStepInfo = fetchedValueAnalysis.getExecutionStepInfo();
if (fetchedValueAnalysis.isNullValue() && executionStepInfo.isNonNullType()) {
NonNullableFieldWasNullException nonNullableFieldWasNullException = new NonNullableFieldWasNullException(executionStepInfo, executionStepInfo.getPath());
return new LeafExecutionResultNode(executionStepInfo, resolvedValue, nonNullableFieldWasNullException);
}
if (fetchedValueAnalysis.isNullValue()) {
return new LeafExecutionResultNode(executionStepInfo, resolvedValue, null);
}
if (fetchedValueAnalysis.getValueType() == FetchedValueAnalysis.FetchedValueType.OBJECT) {
return createUnresolvedNode(fetchedValueAnalysis);
}
if (fetchedValueAnalysis.getValueType() == FetchedValueAnalysis.FetchedValueType.LIST) {
return createListResultNode(fetchedValueAnalysis);
}
return new LeafExecutionResultNode(executionStepInfo, resolvedValue, null);
}
Aggregations