toStringHelper

Creates an instance of ToStringHelper.

This is helpful for implementing Object.toString. Specification by example:

// Returns "ClassName{}"
this.toStringHelper {
}

// Returns "ClassName{x=1}"
this.toStringHelper {
add("x", 1)
}

// Returns "ClassName{x=1, y=foo}"
this.toStringHelper {
add("x", 1)
add("y", "foo")
}

// Returns "ClassName{x=1}"
this.toStringHelper {
omitNullValues()

add("x", 1)
add("y", null)
}

Receiver

the object to generate the string for (typically this), used only for its class name

Return

Returns a string in the format specified by MoreObjects.toStringHelper.

See also

Parameters

builder

The builder applied to ToStringHelper