Class CsvConfig.Builder

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

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

Provides a fluent API for constructing CsvConfig instances.

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

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

    • delimiter

      public CsvConfig.Builder delimiter(char delimiter)
      Sets the field delimiter 设置字段分隔符
      Parameters:
      delimiter - the delimiter character | 分隔符字符
      Returns:
      this builder | 此构建器
    • quoteChar

      public CsvConfig.Builder quoteChar(char quoteChar)
      Sets the quote character 设置引用字符
      Parameters:
      quoteChar - the quote character | 引用字符
      Returns:
      this builder | 此构建器
    • escapeChar

      public CsvConfig.Builder escapeChar(char escapeChar)
      Sets the escape character 设置转义字符
      Parameters:
      escapeChar - the escape character | 转义字符
      Returns:
      this builder | 此构建器
    • lineSeparator

      public CsvConfig.Builder lineSeparator(String lineSeparator)
      Sets the line separator 设置行分隔符
      Parameters:
      lineSeparator - the line separator | 行分隔符
      Returns:
      this builder | 此构建器
    • charset

      public CsvConfig.Builder charset(Charset charset)
      Sets the character set 设置字符集
      Parameters:
      charset - the charset | 字符集
      Returns:
      this builder | 此构建器
    • hasHeader

      public CsvConfig.Builder hasHeader(boolean hasHeader)
      Sets whether the CSV has a header row 设置CSV是否有标题行
      Parameters:
      hasHeader - true if header present | 如果有标题行为true
      Returns:
      this builder | 此构建器
    • trimFields

      public CsvConfig.Builder trimFields(boolean trimFields)
      Sets whether fields should be trimmed 设置是否修剪字段
      Parameters:
      trimFields - true to enable trimming | 为true启用修剪
      Returns:
      this builder | 此构建器
    • skipEmptyRows

      public CsvConfig.Builder skipEmptyRows(boolean skipEmptyRows)
      Sets whether empty rows should be skipped 设置是否跳过空行
      Parameters:
      skipEmptyRows - true to skip empty rows | 为true跳过空行
      Returns:
      this builder | 此构建器
    • maxRows

      public CsvConfig.Builder maxRows(int maxRows)
      Sets the maximum number of rows 设置最大行数
      Parameters:
      maxRows - the max rows | 最大行数
      Returns:
      this builder | 此构建器
    • maxColumns

      public CsvConfig.Builder maxColumns(int maxColumns)
      Sets the maximum number of columns 设置最大列数
      Parameters:
      maxColumns - the max columns | 最大列数
      Returns:
      this builder | 此构建器
    • maxFieldSize

      public CsvConfig.Builder maxFieldSize(int maxFieldSize)
      Sets the maximum field size in bytes 设置最大字段大小(字节)
      Parameters:
      maxFieldSize - the max field size | 最大字段大小
      Returns:
      this builder | 此构建器
    • formulaProtection

      public CsvConfig.Builder formulaProtection(boolean formulaProtection)
      Sets whether formula injection protection is enabled 设置是否启用公式注入保护
      Parameters:
      formulaProtection - true to enable | 为true启用
      Returns:
      this builder | 此构建器
    • nullString

      public CsvConfig.Builder nullString(String nullString)
      Sets the string to write for null values 设置null值的写入字符串
      Parameters:
      nullString - the null string | null值字符串
      Returns:
      this builder | 此构建器
    • build

      public CsvConfig build()
      Builds the CsvConfig 构建CsvConfig
      Returns:
      the CsvConfig instance | CsvConfig实例
      Throws:
      OpenCsvException - if configuration is invalid | 如果配置无效