Package org.codehaus.groovy.runtime

# Class FormatHelper

java.lang.Object
org.codehaus.groovy.runtime.FormatHelper

public class FormatHelper extends Object
Formatting methods

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final MetaClassRegistry`
  `metaRegistry`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `append(Appendable out, Object object)`
  Appends an object to an Appendable using Groovy's default representation for the object.
  `static String`
  `escapeBackslashes(String orig)`
  `static String`
  `format(Object arguments, boolean verbose)`
  `static String`
  `format(Object arguments, boolean inspect, boolean escapeBackslashes)`
  `static String`
  `format(Object arguments, boolean inspect, boolean escapeBackslashes, int maxSize)`
  `static String`
  `format(Object arguments, boolean inspect, boolean escapeBackslashes, int maxSize, boolean safe)`
  `static String`
  `format(Object arguments, boolean verbose, int maxSize)`
  `static String`
  `format(Object arguments, boolean verbose, int maxSize, boolean safe)`
  `static String`
  `inspect(Object self)`
  `static String`
  `toArrayString(Object[] arguments)`
  A helper method to return the string representation of an array of objects with brace boundaries "[" and "]".
  `static String`
  `toArrayString(Object[] arguments, int maxSize, boolean safe)`
  A helper method to return the string representation of an array of objects with brace boundaries "[" and "]".
  `static String`
  `toListString(Collection arg)`
  A helper method to return the string representation of a list with bracket boundaries "[" and "]".
  `static String`
  `toListString(Collection arg, int maxSize)`
  A helper method to return the string representation of a list with bracket boundaries "[" and "]".
  `static String`
  `toListString(Collection arg, int maxSize, boolean safe)`
  A helper method to return the string representation of a list with bracket boundaries "[" and "]".
  `static String`
  `toMapString(Map arg)`
  A helper method to return the string representation of a map with bracket boundaries "[" and "]".
  `static String`
  `toMapString(Map arg, int maxSize)`
  A helper method to return the string representation of a map with bracket boundaries "[" and "]".
  `static String`
  `toString(Object arguments)`
  `static String`
  `toString(Map<String,Object> options, Object arguments)`
  Output the `toString` for the argument(s) with various options to configure.
  `static String`
  `toTypeString(Object[] arguments)`
  A helper method to format the arguments types as a comma-separated list.
  `static String`
  `toTypeString(Object[] arguments, int maxSize)`
  A helper method to format the arguments types as a comma-separated list.
  `static void`
  `write(Writer out, Object object)`
  Writes an object to a Writer using Groovy's default representation for the object.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### metaRegistry

    public static final MetaClassRegistry metaRegistry

- ## Method Details

  - ### toString

    public static String toString(Object arguments)

  - ### inspect

    public static String inspect(Object self)

  - ### format

    public static String format(Object arguments, boolean verbose)

  - ### format

    public static String format(Object arguments, boolean inspect, boolean escapeBackslashes)

  - ### format

    public static String format(Object arguments, boolean verbose, int maxSize)

  - ### format

    public static String format(Object arguments, boolean inspect, boolean escapeBackslashes, int maxSize)

  - ### toString

    public static String toString(@NamedParam(value="safe",type=java.lang.Boolean.class) @NamedParam(value="maxSize",type=java.lang.Integer.class) @NamedParam(value="verbose",type=java.lang.Boolean.class) @NamedParam(value="escapeBackslashes",type=java.lang.Boolean.class) @NamedParam(value="inspect",type=java.lang.Boolean.class) Map<String,Object> options, Object arguments)
    Output the `toString` for the argument(s) with various options to configure. Configuration options:

             safeprovides protection if the toString throws an exception, in which case the exception is swallowed and a dumber default toString is used
             maxSizewill attempt to truncate the output to fit approx the maxSize number of characters, -1 means don't truncate
             inspectif false, render a value by its toString, otherwise use its inspect value
             escapeBackSlasheswhether characters like tab, newline, etc. are converted to their escaped rendering ('\t', '\n', etc.)
             verboseshorthand to turn on both inspect and escapeBackslashes

    Parameters:
      `options` - a map of configuration options
      `arguments` - the argument(s) to calculate the `toString` for
    Returns:
      the string rendering of the argument(s)
    See Also:
      - `DefaultGroovyMethods.inspect(Object)`

  - ### format

    public static String format(Object arguments, boolean verbose, int maxSize, boolean safe)

  - ### format

    public static String format(Object arguments, boolean inspect, boolean escapeBackslashes, int maxSize, boolean safe)

  - ### escapeBackslashes

    public static String escapeBackslashes(String orig)

  - ### toTypeString

    public static String toTypeString(Object[] arguments)
    A helper method to format the arguments types as a comma-separated list.
    Parameters:
      `arguments` - the type to process
    Returns:
      the string representation of the type

  - ### toTypeString

    public static String toTypeString(Object[] arguments, int maxSize)
    A helper method to format the arguments types as a comma-separated list.
    Parameters:
      `arguments` - the type to process
      `maxSize` - stop after approximately this many characters and append '...', -1 means don't stop
    Returns:
      the string representation of the type

  - ### toMapString

    public static String toMapString(Map arg)
    A helper method to return the string representation of a map with bracket boundaries "[" and "]".
    Parameters:
      `arg` - the map to process
    Returns:
      the string representation of the map

  - ### toMapString

    public static String toMapString(Map arg, int maxSize)
    A helper method to return the string representation of a map with bracket boundaries "[" and "]".
    Parameters:
      `arg` - the map to process
      `maxSize` - stop after approximately this many characters and append '...', -1 means don't stop
    Returns:
      the string representation of the map

  - ### toListString

    public static String toListString(Collection arg)
    A helper method to return the string representation of a list with bracket boundaries "[" and "]".
    Parameters:
      `arg` - the collection to process
    Returns:
      the string representation of the collection

  - ### toListString

    public static String toListString(Collection arg, int maxSize)
    A helper method to return the string representation of a list with bracket boundaries "[" and "]".
    Parameters:
      `arg` - the collection to process
      `maxSize` - stop after approximately this many characters and append '...'
    Returns:
      the string representation of the collection

  - ### toListString

    public static String toListString(Collection arg, int maxSize, boolean safe)
    A helper method to return the string representation of a list with bracket boundaries "[" and "]".
    Parameters:
      `arg` - the collection to process
      `maxSize` - stop after approximately this many characters and append '...', -1 means don't stop
      `safe` - whether to use a default object representation for any item in the collection if an exception occurs when generating its toString
    Returns:
      the string representation of the collection

  - ### toArrayString

    public static String toArrayString(Object[] arguments)
    A helper method to return the string representation of an array of objects with brace boundaries "[" and "]".
    Parameters:
      `arguments` - the array to process
    Returns:
      the string representation of the array

  - ### toArrayString

    public static String toArrayString(Object[] arguments, int maxSize, boolean safe)
    A helper method to return the string representation of an array of objects with brace boundaries "[" and "]".
    Parameters:
      `arguments` - the array to process
      `maxSize` - stop after approximately this many characters and append '...'
      `safe` - whether to use a default object representation for any item in the array if an exception occurs when generating its toString
    Returns:
      the string representation of the array

  - ### write

    public static void write(Writer out, Object object) throws IOException
    Writes an object to a Writer using Groovy's default representation for the object.
    Throws:
      `IOException`

  - ### append

    public static void append(Appendable out, Object object) throws IOException
    Appends an object to an Appendable using Groovy's default representation for the object.
    Throws:
      `IOException`