public class ListString
extends java.lang.Object
Constructor and Description |
---|
ListString()
Initializes the instance with ", " as the separator, ": " as key-value-separator and "<>" as empty string.
|
ListString(java.lang.String separator)
Initializes the instance with ": " as key value separator and "<>" as empty string.
|
ListString(java.lang.String separator,
java.lang.String keyValueSeparator,
java.lang.String emptyString)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
append(java.lang.Object object)
Appends the string representation of the given object to the result string.
|
void |
append(java.lang.String key,
java.lang.Object object)
Appends the given key and the given object separated by the key-value-separator.
|
int |
getElemCount()
Returns the number of elements which were appended.
|
java.lang.String |
getResult()
Returns the resulting string representation.
|
java.lang.String |
getResult(int maxCharCount)
Returns the resulting string representation, whereas the number of characters is limited to the given value.
|
boolean |
isEmpty()
Returns true, if and only if no element has been appended yet.
|
java.lang.String |
toString() |
public ListString(java.lang.String separator, java.lang.String keyValueSeparator, java.lang.String emptyString)
separator
- the separator to separate the entries of the list output.keyValueSeparator
- the separator for key value pairs (when calling append(String key,Object object)
).emptyString
- the string which is to be returned, if the list is empty.public ListString(java.lang.String separator)
separator
- the separator to separate the entries of the list output.public ListString()
public void append(java.lang.Object object)
StringRepresentation
, then object.getStringRepresentation is used. Otherwise object.toString is used.object
- the object of which to add the string representation.public void append(java.lang.String key, java.lang.Object object)
key
- the key to append.object
- the object of which to add the string representation.public java.lang.String getResult()
public java.lang.String getResult(int maxCharCount)
maxCharCount
- the maximum character count of the result.public boolean isEmpty()
public int getElemCount()
public java.lang.String toString()
toString
in class java.lang.Object