Class Joiner.MapJoiner

java.lang.Object
cloud.opencode.base.core.Joiner.MapJoiner
Enclosing class:
Joiner

public static final class Joiner.MapJoiner extends Object
A joiner that produces strings from map entries. 从映射条目生成字符串的连接器。
Since:
JDK 25, opencode-base-core V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • skipNullValues

      public Joiner.MapJoiner skipNullValues()
      Returns a map joiner that skips entries with null values. 返回跳过具有空值的条目的映射连接器。
      Returns:
      the map joiner - 映射连接器
    • useForNull

      public Joiner.MapJoiner useForNull(String nullText)
      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

      public String join(Map<?,?> map)
      Joins the given map into a string. 将给定映射连接成字符串。
      Parameters:
      map - the map - 映射
      Returns:
      the joined string - 连接后的字符串
    • join

      public String join(Iterable<? extends Map.Entry<?,?>> entries)
      Joins the given map entries into a string. 将给定映射条目连接成字符串。
      Parameters:
      entries - the entries - 条目
      Returns:
      the joined string - 连接后的字符串
    • appendTo

      public StringBuilder appendTo(StringBuilder sb, Map<?,?> map)
      Appends the joined map to the given StringBuilder. 将连接后的映射追加到给定的 StringBuilder。
      Parameters:
      sb - the StringBuilder - StringBuilder
      map - the map - 映射
      Returns:
      the StringBuilder - StringBuilder
    • appendTo

      public StringBuilder appendTo(StringBuilder sb, Iterable<? extends Map.Entry<?,?>> entries)
      Appends the joined entries to the given StringBuilder. 将连接后的条目追加到给定的 StringBuilder。
      Parameters:
      sb - the StringBuilder - StringBuilder
      entries - the entries - 条目
      Returns:
      the StringBuilder - StringBuilder
    • appendTo

      public <A extends Appendable> A appendTo(A appendable, Map<?,?> map) throws IOException
      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 IOException
      Appends 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 错误