Class Serializer


  • public class Serializer
    extends Object
    • Method Detail

      • escape

        public static String escape​(String input)
        Creates graphql safe string Nested quotes are escaped
        Parameters:
        input - string
        Returns:
        escaped string
      • quote

        public static String quote​(String input)
        Creates graphql safe string Surrounds input string with double quotes, nested quotes are escaped
        Parameters:
        input - string
        Returns:
        quoted string
      • arrayWithQuotes

        public static String arrayWithQuotes​(String[] input)
        Creates json safe array string Surrounds each input string with double quotes, nested quotes are escaped
        Parameters:
        input - array of strings
        Returns:
        json safe array string
      • array

        public static <T> String array​(T[] input)
        Creates array string It is up to user to make elements json safe
        Parameters:
        input - array of arbitrary elements
        Returns:
        array string
      • array

        public static <T,​R> String array​(T[] input,
                                               Function<T,​R> mapper)
        Creates array string It is up to user to make elements json safe
        Parameters:
        input - array of arbitrary elements
        mapper - maps single element before building array
        Returns:
        array string