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

com.infomaximum.cluster.graphql.preparecustomfield.PrepareCustomFieldUtils Maven / Gradle / Ivy

The newest version!
package com.infomaximum.cluster.graphql.preparecustomfield;

import graphql.language.Field;
import graphql.language.SourceLocation;
import graphql.schema.DataFetchingEnvironment;

public class PrepareCustomFieldUtils {

    public static String getKeyField(DataFetchingEnvironment dataFetchingEnvironment) {
        if (dataFetchingEnvironment.getMergedField().getFields().size() < 1) {
            throw new RuntimeException("Not support zero field");
        }
        Field field = dataFetchingEnvironment.getMergedField().getFields().get(0);

        return getKeyField(field);
    }

    public static String getKeyField(Field field) {
        SourceLocation sourceLocation = field.getSourceLocation();

        return new StringBuilder()
                .append(sourceLocation.getLine()).append(':')
                .append(sourceLocation.getColumn())
                .toString();
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy