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

graphql.schema.GraphQLTypeUtil Maven / Gradle / Ivy

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

public class GraphQLTypeUtil {

    /**
     * This will get the unwrapped type name that includes the non null and list wrappers
     * so it might be '[typeName!]'
     *
     * @param type the type in play
     *
     * @return the unwrapped type name
     */
    public static String getUnwrappedTypeName(GraphQLType type) {
        StringBuilder sb = new StringBuilder();
        if (type instanceof GraphQLNonNull) {
            sb.append(getUnwrappedTypeName(((GraphQLNonNull) type).getWrappedType()));
            sb.append("!");
        } else if (type instanceof GraphQLList) {
            sb.append("[");
            sb.append(getUnwrappedTypeName(((GraphQLList) type).getWrappedType()));
            sb.append("]");
        } else {
            sb.append(type.getName());
        }
        return sb.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy