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

graphql.nadel.normalized.NormalizedQueryFromAst Maven / Gradle / Ivy

There is a newer version: 2021-03-26T09-09-21-fabd441
Show newest version
package graphql.nadel.normalized;

import graphql.Internal;
import graphql.execution.MergedField;
import graphql.nadel.dsl.NodeId;

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

@Internal
public class NormalizedQueryFromAst {

    private final List topLevelFields;
    private final Map> normalizedFieldsByFieldId;
    private final Map mergedFieldByNormalizedFields;

    public NormalizedQueryFromAst(List topLevelFields,
                                  Map> normalizedFieldsByFieldId,
                                  Map mergedFieldByNormalizedFields) {
        this.topLevelFields = topLevelFields;
        this.normalizedFieldsByFieldId = normalizedFieldsByFieldId;
        this.mergedFieldByNormalizedFields = mergedFieldByNormalizedFields;
    }

    public List getTopLevelFields() {
        return topLevelFields;
    }

    public Map> getNormalizedFieldsByFieldId() {
        return normalizedFieldsByFieldId;
    }

    public List getNormalizedFieldsByFieldId(String astFieldId) {
        return normalizedFieldsByFieldId.get(astFieldId);
    }

    public Map getMergedFieldByNormalizedFields() {
        return mergedFieldByNormalizedFields;
    }

    public List getFieldIds(NormalizedQueryField normalizedQueryField) {
        MergedField mergedField = mergedFieldByNormalizedFields.get(normalizedQueryField);
        return NodeId.getIds(mergedField);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy