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

graphql.execution.ExecutionParameters Maven / Gradle / Ivy

The newest version!
package graphql.execution;

import graphql.language.Field;

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

import static graphql.Assert.assertNotNull;

/**
 * The parameters that are passed to execution strategies
 */
public class ExecutionParameters {
    private final TypeInfo typeInfo;
    private final Object source;
    private final Map arguments;
    private final Map> fields;

    private ExecutionParameters(TypeInfo typeInfo, Object source, Map> fields, Map arguments) {
        this.typeInfo = assertNotNull(typeInfo, "");
        this.fields = assertNotNull(fields, "");
        this.source = source;
        this.arguments = arguments;
    }

    public TypeInfo typeInfo() {
        return typeInfo;
    }

    public Object source() {
        return source;
    }

    public Map> fields() {
        return fields;
    }

    public Map arguments() {
        return arguments;
    }

    public static Builder newParameters() {
        return new Builder();
    }

    @Override
    public String toString() {
        return String.format("ExecutionParameters { typeInfo=%s, source=%s, fields=%s }",
                typeInfo, source, fields);
    }

    public static class Builder {
        TypeInfo typeInfo;
        Object source;
        Map> fields;
        Map arguments;

        public Builder typeInfo(TypeInfo type) {
            this.typeInfo = type;
            return this;
        }

        public Builder typeInfo(TypeInfo.Builder type) {
            this.typeInfo = type.build();
            return this;
        }

        public Builder fields(Map> fields) {
            this.fields = fields;
            return this;
        }

        public Builder source(Object source) {
            this.source = source;
            return this;
        }

        public Builder arguments(Map arguments) {
            this.arguments = arguments;
            return this;
        }

        public ExecutionParameters build() {
            return new ExecutionParameters(typeInfo, source, fields, arguments);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy