public class ToStringBuilder extends Object
String
for
Object.toString()
.
The builder uses a class name and any number of name-value pairs. The format of the output is:
ClassName[name=value,arrayName=[value,value]]
Constructor and Description |
---|
ToStringBuilder() |
Modifier and Type | Method and Description |
---|---|
ToStringBuilder |
append(String name,
byte[] value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
char value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
char[] value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
Collection<?> value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
double value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
double[] value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
float value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
float[] value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
int value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
int[] value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
long value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
long[] value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
Object value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
Object[] value)
Appends the specified name-value pair.
|
ToStringBuilder |
append(String name,
short[] value)
Appends the specified name-value pair.
|
static ToStringBuilder |
forClass(Class<?> clazz)
Creates a new
ToStringBuilder for the specified Class . |
static ToStringBuilder |
forClassName(String className)
Creates a new
ToStringBuilder for the specified
className . |
String |
toString() |
public static ToStringBuilder forClassName(String className)
ToStringBuilder
for the specified
className
.className
- the name of the Class
whose toString()
is being built; cannot be null
public static ToStringBuilder forClass(Class<?> clazz)
ToStringBuilder
for the specified Class
.
This creates a ToStringBuilder
from
Class.getSimpleName()
.clazz
- the Class
whose toString()
is being built;
cannot be null
public ToStringBuilder append(String name, Object value)
value
's
toString()
method is used for the textual representation. If
the value
is null
, "null"
will be used.name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, int value)
name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, long value)
name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, float value)
name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, double value)
name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, char value)
name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, Object[] value)
value
is
null
, "null"
will be used.name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, byte[] value)
value
is
null
, "null"
will be used.name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, short[] value)
value
is
null
, "null"
will be used.name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, int[] value)
value
is
null
, "null"
will be used.name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, long[] value)
value
is
null
, "null"
will be used.name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, float[] value)
value
is
null
, "null"
will be used.name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, double[] value)
value
is
null
, "null"
will be used.name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, char[] value)
value
is
null
, "null"
will be used.name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingpublic ToStringBuilder append(String name, Collection<?> value)
value
is
null
, "null"
will be used.name
- the name of the value; cannot be null
value
- the value to appendToStringBuilder
for chainingCopyright © 2021 Frostphyr. All rights reserved.