Class CsvDocument.Builder

java.lang.Object
cloud.opencode.base.csv.CsvDocument.Builder
Enclosing class:
CsvDocument

public static final class CsvDocument.Builder extends Object
Builder for CsvDocument CsvDocument构建器

Provides a fluent API for constructing CsvDocument instances.

提供用于构建CsvDocument实例的流式API。

Since:
JDK 25, opencode-base-csv V1.0.3
Author:
Leon Soo
  • Method Details

    • header

      public CsvDocument.Builder header(String... headers)
      Sets the header names 设置标题名称
      Parameters:
      headers - the header names | 标题名称
      Returns:
      this builder | 此构建器
    • header

      public CsvDocument.Builder header(List<String> headers)
      Sets the header names from a list 从列表设置标题名称
      Parameters:
      headers - the header names | 标题名称
      Returns:
      this builder | 此构建器
    • addRow

      public CsvDocument.Builder addRow(String... fields)
      Adds a row from field values 从字段值添加行
      Parameters:
      fields - the field values | 字段值
      Returns:
      this builder | 此构建器
    • addRow

      public CsvDocument.Builder addRow(CsvRow row)
      Adds an existing CsvRow 添加现有的CsvRow
      Parameters:
      row - the row to add | 要添加的行
      Returns:
      this builder | 此构建器
      Throws:
      NullPointerException - if row is null | 如果row为null
    • build

      public CsvDocument build()
      Builds the CsvDocument 构建CsvDocument
      Returns:
      the CsvDocument instance | CsvDocument实例