com.dtolabs.rundeck.core.utils
Class ToStringFormatter

java.lang.Object
  extended by com.dtolabs.rundeck.core.utils.ToStringFormatter

public class ToStringFormatter
extends java.lang.Object

a toString formatter utility. Takes a map of key value pairs that represent the fields in an object and prints them in a formatted manner. Nested objects included in the map will have their toString() method called.

Example output on an instance of com.dtolabs.rundeck.core.types.controller.ExecuteAction: ExecuteAction{user='rubble', failonerror='true', command='Command{executionDaemonized='false', name='aCommand'}', context='Context{project='TestSshCommand', resourceType='TypeA', resourceName='aTypeInstance'}', strategy='ant', adExecutable='ad', properties='[]'}


Method Summary
static ToStringFormatter create(java.lang.Object obj, java.util.Map params)
          Factory method.
 java.lang.String toString()
          Prints message.
 java.lang.String toString(boolean fiilterNulls)
          Prints message with contents of params map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static ToStringFormatter create(java.lang.Object obj,
                                       java.util.Map params)
Factory method. Creates a formatter

Parameters:
obj - Object to print toString message for
params - map of key value pairs to print in message
Returns:
new instance

toString

public java.lang.String toString()
Prints message. Defaults to filtering null values out of the output.

Overrides:
toString in class java.lang.Object
Returns:
output message

toString

public java.lang.String toString(boolean fiilterNulls)
Prints message with contents of params map. The name of the class does not include it's package namespace.

Parameters:
fiilterNulls - if true, null values and their keys will not be included
Returns:
output message