Module org.elasticsearch.server
Package org.elasticsearch.common
Class Strings.BoundedDelimitedStringCollector
java.lang.Object
org.elasticsearch.common.Strings.BoundedDelimitedStringCollector
- Enclosing class:
Strings
Collects a sequence of objects into a delimited string, dropping objects once the string reaches a certain maximum length. Similar to
Strings.collectionToDelimitedStringWithLimit(java.lang.Iterable<?>, java.lang.String, int, java.lang.StringBuilder) except that this doesn't need the collection of items to be provided up front.-
Constructor Summary
ConstructorsConstructorDescriptionBoundedDelimitedStringCollector(StringBuilder stringBuilder, String delimiter, int appendLimit) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendItem(Object item) Add the given item's string representation to the string, with a delimiter if necessary and surrounded by the given prefix and suffix, as long as the string is not already too long.voidfinish()Complete the collection, adding to the string a summary of omitted objects, if any.
-
Constructor Details
-
BoundedDelimitedStringCollector
public BoundedDelimitedStringCollector(StringBuilder stringBuilder, String delimiter, int appendLimit)
-
-
Method Details
-
appendItem
Add the given item's string representation to the string, with a delimiter if necessary and surrounded by the given prefix and suffix, as long as the string is not already too long. -
finish
public void finish()Complete the collection, adding to the string a summary of omitted objects, if any.
-