Annotation Interface CsvFormat
CSV Format - Specifies formatting for a CSV field binding
CSV格式 - 指定CSV字段绑定的格式
Controls how field values are formatted and parsed during CSV binding.
Use pattern() for date/number formats and nullValue()
for handling null values.
控制CSV绑定期间字段值的格式化和解析。使用 pattern() 指定日期/数字格式,
使用 nullValue() 处理null值。
Usage Examples | 使用示例:
public record Order(
@CsvColumn("date") @CsvFormat(pattern = "yyyy-MM-dd") LocalDate orderDate,
@CsvColumn("amount") @CsvFormat(pattern = "#,##0.00") BigDecimal amount,
@CsvColumn("note") @CsvFormat(nullValue = "N/A") String note
) {}
- Since:
- JDK 25, opencode-base-csv V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
pattern
String patternThe date/number format pattern (empty = use default) 日期/数字格式模式(空 = 使用默认值)- Returns:
- the format pattern | 格式模式
- Default:
""
-
nullValue
String nullValueThe value to use when the field is null (empty = write empty string) 字段为null时使用的值(空 = 写入空字符串)- Returns:
- the null value representation | null值表示
- Default:
""
-