Class Joiner.MapJoiner
java.lang.Object
cloud.opencode.base.core.Joiner.MapJoiner
- Enclosing class:
Joiner
A joiner that produces strings from map entries.
从映射条目生成字符串的连接器。
- Since:
- JDK 25, opencode-base-core V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescription<A extends Appendable>
AAppends the joined entries to the given Appendable.<A extends Appendable>
AAppends the joined map to the given Appendable.appendTo(StringBuilder sb, Iterable<? extends Map.Entry<?, ?>> entries) Appends the joined entries to the given StringBuilder.appendTo(StringBuilder sb, Map<?, ?> map) Appends the joined map to the given StringBuilder.Joins the given map entries into a string.Joins the given map into a string.Returns a map joiner that skips entries with null values.useForNull(String nullText) Returns a map joiner that replaces null values with the given text.
-
Method Details
-
skipNullValues
Returns a map joiner that skips entries with null values. 返回跳过具有空值的条目的映射连接器。- Returns:
- the map joiner - 映射连接器
-
useForNull
Returns a map joiner that replaces null values with the given text. 返回用给定文本替换空值的映射连接器。- Parameters:
nullText- the text to use for null values - 用于空值的文本- Returns:
- the map joiner - 映射连接器
-
join
-
join
-
appendTo
Appends the joined map to the given StringBuilder. 将连接后的映射追加到给定的 StringBuilder。- Parameters:
sb- the StringBuilder - StringBuildermap- the map - 映射- Returns:
- the StringBuilder - StringBuilder
-
appendTo
Appends the joined entries to the given StringBuilder. 将连接后的条目追加到给定的 StringBuilder。- Parameters:
sb- the StringBuilder - StringBuilderentries- the entries - 条目- Returns:
- the StringBuilder - StringBuilder
-
appendTo
Appends the joined map to the given Appendable. 将连接后的映射追加到给定的 Appendable。- Type Parameters:
A- the appendable type - 可追加类型- Parameters:
appendable- the appendable - 可追加对象map- the map - 映射- Returns:
- the appendable - 可追加对象
- Throws:
IOException- if an I/O error occurs - 如果发生 I/O 错误
-
appendTo
public <A extends Appendable> A appendTo(A appendable, Iterable<? extends Map.Entry<?, ?>> entries) throws IOExceptionAppends the joined entries to the given Appendable. 将连接后的条目追加到给定的 Appendable。- Type Parameters:
A- the appendable type - 可追加类型- Parameters:
appendable- the appendable - 可追加对象entries- the entries - 条目- Returns:
- the appendable - 可追加对象
- Throws:
IOException- if an I/O error occurs - 如果发生 I/O 错误
-