All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.execution.SimpleExecutionStrategy Maven / Gradle / Ivy

There is a newer version: 230521-nf-execution
Show newest version
package graphql.execution;

import graphql.ExecutionResult;
import graphql.ExecutionResultImpl;
import graphql.language.Field;
import graphql.schema.GraphQLObjectType;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class SimpleExecutionStrategy extends ExecutionStrategy {
    @Override
    public ExecutionResult execute(ExecutionContext executionContext, GraphQLObjectType parentType, Object source, Map> fields) {
        Map results = new LinkedHashMap();
        for (String fieldName : fields.keySet()) {
            List fieldList = fields.get(fieldName);
            ExecutionResult resolvedResult = resolveField(executionContext, parentType, source, fieldList);

            results.put(fieldName, resolvedResult != null ? resolvedResult.getData() : null);
        }
        return new ExecutionResultImpl(results, executionContext.getErrors());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy