Class CsvConfig.Builder
java.lang.Object
cloud.opencode.base.csv.CsvConfig.Builder
- Enclosing class:
CsvConfig
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 Summary
Modifier and TypeMethodDescriptionbuild()Builds the CsvConfig 构建CsvConfigSets the character set 设置字符集delimiter(char delimiter) Sets the field delimiter 设置字段分隔符escapeChar(char escapeChar) Sets the escape character 设置转义字符formulaProtection(boolean formulaProtection) Sets whether formula injection protection is enabled 设置是否启用公式注入保护hasHeader(boolean hasHeader) Sets whether the CSV has a header row 设置CSV是否有标题行lineSeparator(String lineSeparator) Sets the line separator 设置行分隔符maxColumns(int maxColumns) Sets the maximum number of columns 设置最大列数maxFieldSize(int maxFieldSize) Sets the maximum field size in bytes 设置最大字段大小(字节)maxRows(int maxRows) Sets the maximum number of rows 设置最大行数nullString(String nullString) Sets the string to write for null values 设置null值的写入字符串quoteChar(char quoteChar) Sets the quote character 设置引用字符skipEmptyRows(boolean skipEmptyRows) Sets whether empty rows should be skipped 设置是否跳过空行trimFields(boolean trimFields) Sets whether fields should be trimmed 设置是否修剪字段
-
Method Details
-
delimiter
Sets the field delimiter 设置字段分隔符- Parameters:
delimiter- the delimiter character | 分隔符字符- Returns:
- this builder | 此构建器
-
quoteChar
Sets the quote character 设置引用字符- Parameters:
quoteChar- the quote character | 引用字符- Returns:
- this builder | 此构建器
-
escapeChar
Sets the escape character 设置转义字符- Parameters:
escapeChar- the escape character | 转义字符- Returns:
- this builder | 此构建器
-
lineSeparator
Sets the line separator 设置行分隔符- Parameters:
lineSeparator- the line separator | 行分隔符- Returns:
- this builder | 此构建器
-
charset
Sets the character set 设置字符集- Parameters:
charset- the charset | 字符集- Returns:
- this builder | 此构建器
-
hasHeader
Sets whether the CSV has a header row 设置CSV是否有标题行- Parameters:
hasHeader- true if header present | 如果有标题行为true- Returns:
- this builder | 此构建器
-
trimFields
Sets whether fields should be trimmed 设置是否修剪字段- Parameters:
trimFields- true to enable trimming | 为true启用修剪- Returns:
- this builder | 此构建器
-
skipEmptyRows
Sets whether empty rows should be skipped 设置是否跳过空行- Parameters:
skipEmptyRows- true to skip empty rows | 为true跳过空行- Returns:
- this builder | 此构建器
-
maxRows
Sets the maximum number of rows 设置最大行数- Parameters:
maxRows- the max rows | 最大行数- Returns:
- this builder | 此构建器
-
maxColumns
Sets the maximum number of columns 设置最大列数- Parameters:
maxColumns- the max columns | 最大列数- Returns:
- this builder | 此构建器
-
maxFieldSize
Sets the maximum field size in bytes 设置最大字段大小(字节)- Parameters:
maxFieldSize- the max field size | 最大字段大小- Returns:
- this builder | 此构建器
-
formulaProtection
Sets whether formula injection protection is enabled 设置是否启用公式注入保护- Parameters:
formulaProtection- true to enable | 为true启用- Returns:
- this builder | 此构建器
-
nullString
Sets the string to write for null values 设置null值的写入字符串- Parameters:
nullString- the null string | null值字符串- Returns:
- this builder | 此构建器
-
build
Builds the CsvConfig 构建CsvConfig- Returns:
- the CsvConfig instance | CsvConfig实例
- Throws:
OpenCsvException- if configuration is invalid | 如果配置无效
-