public class StringDescriptionWriter extends AbstractDescriptionWriter
Description writer that accumulates a string.
Modifier and Type | Method and Description |
---|---|
java.lang.String |
finish()
Get the accumulated string description.
|
DescriptionWriter |
putField(java.lang.String name,
byte[] value)
Put a byte array field.
|
DescriptionWriter |
putField(java.lang.String name,
double value)
Put a floating-point field.
|
DescriptionWriter |
putField(java.lang.String name,
long value)
Put an integer field.
|
DescriptionWriter |
putField(java.lang.String name,
java.lang.String value)
Put a field into the description.
|
<T> DescriptionWriter |
putField(java.lang.String name,
T value,
Describer<? super T> describer)
Put an object field into the description.
|
<T> DescriptionWriter |
putList(java.lang.String name,
java.lang.Iterable<T> objects,
Describer<? super T> describer)
Put a field with a list of values.
|
putField, putList
public java.lang.String finish()
Get the accumulated string description.
public DescriptionWriter putField(java.lang.String name, java.lang.String value)
DescriptionWriter
Put a field into the description.
name
- The field name. It cannot begin with an underscore.value
- The field value.public DescriptionWriter putField(java.lang.String name, long value)
DescriptionWriter
Put an integer field.
name
- The field name.value
- The field value.DescriptionWriter.putField(String, String)
public DescriptionWriter putField(java.lang.String name, double value)
DescriptionWriter
Put a floating-point field.
name
- The field name.value
- The field value.DescriptionWriter.putField(String, String)
public DescriptionWriter putField(java.lang.String name, byte[] value)
DescriptionWriter
Put a byte array field.
name
- The field name.value
- The field value.DescriptionWriter.putField(String, String)
public <T> DescriptionWriter putList(java.lang.String name, java.lang.Iterable<T> objects, Describer<? super T> describer)
DescriptionWriter
Put a field with a list of values.
name
- The field name.objects
- The list of objects.describer
- A describer for the objects.public <T> DescriptionWriter putField(java.lang.String name, T value, Describer<? super T> describer)
DescriptionWriter
Put an object field into the description.
name
- The field name. It cannot begin with an underscore.value
- The field value. If it implements Describable
, then it is asked to write its description; otherwise, some default behavior is used.describer
- A describer to describe the value.