Class Objects.ToStringHelper (1.43.0)

public static final class Objects.ToStringHelper

Support class for Objects#toStringHelper.

Inheritance

Object > Objects.ToStringHelper

Methods

add(String name, Object value)

public Objects.ToStringHelper add(String name, Object value)

Adds a name/value pair to the formatted output in name=value format. If value is null, the string "null" is used, unless #omitNullValues() is called, in which case this name/value pair will not be added.

Parameters
NameDescription
nameString
valueObject
Returns
TypeDescription
Objects.ToStringHelper

omitNullValues()

public Objects.ToStringHelper omitNullValues()

Configures the ToStringHelper so #toString() will ignore properties with null value. The order of calling this method, relative to the add()/addValue() methods, is not significant.

Returns
TypeDescription
Objects.ToStringHelper

toString()

public String toString()
Returns
TypeDescription
String
Overrides