Package org.codehaus.groovy.runtime
Class FormatHelper
java.lang.Object
org.codehaus.groovy.runtime.FormatHelper
Formatting methods
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidappend(Appendable out, Object object) Appends an object to an Appendable using Groovy's default representation for the object.static StringescapeBackslashes(String orig) static Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic StringtoArrayString(Object[] arguments) A helper method to return the string representation of an array of objects with brace boundaries "[" and "]".static StringtoArrayString(Object[] arguments, int maxSize, boolean safe) A helper method to return the string representation of an array of objects with brace boundaries "[" and "]".static StringtoListString(Collection arg) A helper method to return the string representation of a list with bracket boundaries "[" and "]".static StringtoListString(Collection arg, int maxSize) A helper method to return the string representation of a list with bracket boundaries "[" and "]".static StringtoListString(Collection arg, int maxSize, boolean safe) A helper method to return the string representation of a list with bracket boundaries "[" and "]".static StringtoMapString(Map arg) A helper method to return the string representation of a map with bracket boundaries "[" and "]".static StringtoMapString(Map arg, int maxSize) A helper method to return the string representation of a map with bracket boundaries "[" and "]".static Stringstatic StringOutput thetoStringfor the argument(s) with various options to configure.static StringtoTypeString(Object[] arguments) A helper method to format the arguments types as a comma-separated list.static StringtoTypeString(Object[] arguments, int maxSize) A helper method to format the arguments types as a comma-separated list.static voidWrites an object to a Writer using Groovy's default representation for the object.
- 
Field Details- 
metaRegistry
 
- 
- 
Method Details- 
toString
- 
inspect
- 
format
- 
format
- 
format
- 
format
- 
toStringOutput thetoStringfor the argument(s) with various options to configure. Configuration options:- safe
- provides protection if the toStringthrows an exception, in which case the exception is swallowed and a dumber defaulttoStringis used
- maxSize
- will attempt to truncate the output to fit approx the maxSize number of characters, -1 means don't truncate
- inspect
- if false, render a value by its toString, otherwise use itsinspectvalue
- escapeBackSlashes
- whether characters like tab, newline, etc. are converted to their escaped rendering ('\t', '\n', etc.)
- verbose
- shorthand to turn on both inspectandescapeBackslashes
 - Parameters:
- options- a map of configuration options
- arguments- the argument(s) to calculate the- toStringfor
- Returns:
- the string rendering of the argument(s)
- See Also:
 
- 
format
- 
format
- 
escapeBackslashes
- 
toTypeStringA 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
 
- 
toTypeStringA 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
 
- 
toMapStringA 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
 
- 
toMapStringA 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
 
- 
toListStringA 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
 
- 
toListStringA 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
 
- 
toListStringA 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
 
- 
toArrayStringA 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
 
- 
toArrayStringA 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
 
- 
writeWrites an object to a Writer using Groovy's default representation for the object.- Throws:
- IOException
 
- 
appendAppends an object to an Appendable using Groovy's default representation for the object.- Throws:
- IOException
 
 
-