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

graphql.nadel.engine.ResolvedValueMapper Maven / Gradle / Ivy

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

import graphql.Internal;
import graphql.introspection.Introspection;
import graphql.nadel.result.ExecutionResultNode;

@Internal
public class ResolvedValueMapper {

    private static final String UNDERSCORE_TYPENAME = Introspection.TypeNameMetaFieldDef.getName();

    public ExecutionResultNode mapCompletedValue(ExecutionResultNode node, UnapplyEnvironment environment) {
        if (node.getFieldName().equals(UNDERSCORE_TYPENAME)) {
            String type = (String) node.getCompletedValue();
            String renamed = environment.typeRenameMappings.get(type);
            if (renamed != null) {
                return node.withNewCompletedValue(renamed);
            }
        }

        return node;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy