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

graphql.execution.CoercedVariables Maven / Gradle / Ivy

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

import graphql.PublicApi;
import graphql.collect.ImmutableKit;
import graphql.collect.ImmutableMapWithNullValues;

import java.util.Map;

/**
 * Holds coerced variables, that is their values are now in a canonical form.
 */
@PublicApi
public class CoercedVariables {
    private final ImmutableMapWithNullValues coercedVariables;

    public CoercedVariables(Map coercedVariables) {
        this.coercedVariables = ImmutableMapWithNullValues.copyOf(coercedVariables);
    }

    public Map toMap() {
        return coercedVariables;
    }

    public boolean containsKey(String key) {
        return coercedVariables.containsKey(key);
    }

    public Object get(String key) {
        return coercedVariables.get(key);
    }

    public static CoercedVariables emptyVariables() {
        return new CoercedVariables(ImmutableKit.emptyMap());
    }

    public static CoercedVariables of(Map coercedVariables) {
        return new CoercedVariables(coercedVariables);
    }

    @Override
    public String toString() {
        return coercedVariables.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy