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

graphql.execution.MergedSelectionSet Maven / Gradle / Ivy

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

import com.google.common.collect.ImmutableList;
import graphql.Assert;
import graphql.PublicApi;

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


@PublicApi
public class MergedSelectionSet {

    private final Map subFields;

    private MergedSelectionSet(Map subFields) {
        this.subFields = Assert.assertNotNull(subFields);
    }

    public Map getSubFields() {
        return subFields;
    }

    public List getSubFieldsList() {
        return ImmutableList.copyOf(subFields.values());
    }

    public int size() {
        return subFields.size();
    }

    public Set keySet() {
        return subFields.keySet();
    }

    public MergedField getSubField(String key) {
        return subFields.get(key);
    }

    public List getKeys() {
        return ImmutableList.copyOf(keySet());
    }

    public boolean isEmpty() {
        return subFields.isEmpty();
    }

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

    public static class Builder {
        private Map subFields = new LinkedHashMap<>();

        private Builder() {

        }

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

        public MergedSelectionSet build() {
            return new MergedSelectionSet(subFields);
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy