Class MultiLineToStringBuilder


  • public class MultiLineToStringBuilder
    extends Object
    Static utility class for generating JSON like multi line Strings from Maps, List, Arrays and the ExecutionContext.

    These methods do traverse sub Maps/Collections/Arrays. They can handle references to parent nodes or to them selfs.

    Author:
    maurice_zeijen
    • Method Detail

      • toString

        public static String toString​(ExecutionContext executionContext)
        Creates a multi line JSON like string for the execution context
        Parameters:
        executionContext - The ExecutionContext
        Returns:
        The String representation
      • toString

        public static String toString​(Map<?,​?> map)
        Creates a multi line JSON like string representation from a Map
        Parameters:
        map - The Map to create the string from
        Returns:
        The String representation of the Map
      • toString

        public static String toString​(Map<?,​?> map,
                                      List<?> filterKeyList)
        Creates a multi line JSON like string representation from a Map
        Parameters:
        map - The Map to create the string from
        filterKeyList - A list of objects that are ignored when encountered as keys
        Returns:
        The String representation of the Map
      • toString

        public static String toString​(Collection<?> collection)
        Creates a multi line JSON like string representation from a Collection.
        Parameters:
        map - The Map to create the string from
        Returns:
        The String representation of the Map
      • toString

        public static String toString​(Collection<?> collection,
                                      List<?> filterKeyList)
        Creates a multi line JSON like string representation from a Collection
        Parameters:
        map - The Map to create the string from
        filterKeyList - A list of objects that are ignored when encountered as keys
        Returns:
        The String representation of the Map
      • toString

        public static String toString​(Object[] array)
        Creates a multi line JSON like string representation from an Array
        Parameters:
        map - The Map to create the string from
        Returns:
        The String representation of the Map
      • toString

        public static String toString​(Object[] array,
                                      List<?> filterKeyList)
        Creates a multi line JSON like string representation from an Array
        Parameters:
        map - The Map to create the string from
        filterKeyList - A list of objects that are ignored when encountered as keys
        Returns:
        The String representation of the Map
      • repeat

        protected static String repeat​(String str,
                                       int repeat)