You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/01/03 20:20:28 UTC
(commons-csv) branch master updated: Javadoc: Don't use deprecated code
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git
The following commit(s) were added to refs/heads/master by this push:
new 15a38a4e Javadoc: Don't use deprecated code
15a38a4e is described below
commit 15a38a4e26a64e8b07db3544a069f920f8802fc2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jan 3 15:20:23 2025 -0500
Javadoc: Don't use deprecated code
---
.../java/org/apache/commons/csv/CSVFormat.java | 37 ++++++++++++----------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index 4990457b..402b0237 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -93,7 +93,7 @@ import org.apache.commons.io.output.AppendableOutputStream;
* </p>
*
* <pre>{@code
- * CSVFormat.EXCEL.withNullString("N/A").withIgnoreSurroundingSpaces(true);
+ * CSVFormat.EXCEL.builder().setNullString("N/A").setIgnoreSurroundingSpaces(true).get();
* }</pre>
*
* <h2>Defining column names</h2>
@@ -103,7 +103,7 @@ import org.apache.commons.io.output.AppendableOutputStream;
* </p>
*
* <pre>{@code
- * CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3");
+ * CSVFormat.EXCEL.builder().setHeader("Col1", "Col2", "Col3").get();
* }</pre>
*
* <p>
@@ -122,7 +122,7 @@ import org.apache.commons.io.output.AppendableOutputStream;
*
* <pre>{@code
* Reader in = ...;
- * CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3").parse(in);
+ * CSVFormat.EXCEL.builder().setHeader("Col1", "Col2", "Col3").get().parse(in);
* }</pre>
*
* <p>
@@ -137,7 +137,7 @@ import org.apache.commons.io.output.AppendableOutputStream;
* </p>
*
* <pre>
- * CSVFormat.EXCEL.withHeader();
+ * CSVFormat.EXCEL.builder().setHeader().get();
* </pre>
*
* <p>
@@ -993,7 +993,7 @@ public final class CSVFormat implements Serializable {
* </p>
*
* <pre>
- * CSVFormat fmt = CSVFormat.EXCEL.withDelimiter(';');
+ * CSVFormat fmt = CSVFormat.EXCEL.builder().setDelimiter(';').get();
* </pre>
*
* <p>
@@ -2693,6 +2693,7 @@ public final class CSVFormat implements Serializable {
return builder().setEscape(escape).get();
}
+ // @formatter:off
/**
* Builds a new {@code CSVFormat} using the first record as header.
*
@@ -2701,7 +2702,10 @@ public final class CSVFormat implements Serializable {
* </p>
*
* <pre>
- * CSVFormat format = aFormat.withHeader().withSkipHeaderRecord();
+ * CSVFormat format = aFormat.builder()
+ * .setHeader()
+ * .setSkipHeaderRecord(true)
+ * .get();
* </pre>
*
* @return A new CSVFormat that is equal to this but using the first record as header.
@@ -2710,6 +2714,7 @@ public final class CSVFormat implements Serializable {
* @since 1.3
* @deprecated Use {@link Builder#setHeader(String...) Builder#setHeader()}.{@link Builder#setSkipHeaderRecord(boolean) setSkipHeaderRecord(true)}.
*/
+ // @formatter:on
@Deprecated
public CSVFormat withFirstRecordAsHeader() {
// @formatter:off
@@ -2728,11 +2733,11 @@ public final class CSVFormat implements Serializable {
* </p>
*
* <pre>
- * public enum Header {
+ * public enum MyHeader {
* Name, Email, Phone
* }
- *
- * CSVFormat format = aformat.withHeader(Header.class);
+ * ...
+ * CSVFormat format = aFormat.builder().setHeader(MyHeader.class).get();
* </pre>
* <p>
* The header is also used by the {@link CSVPrinter}.
@@ -2755,13 +2760,13 @@ public final class CSVFormat implements Serializable {
* input file with:
*
* <pre>
- * CSVFormat format = aformat.withHeader();
+ * CSVFormat format = aFormat.builder().setHeader().get();
* </pre>
*
* or specified manually with:
*
* <pre>
- * CSVFormat format = aformat.withHeader(resultSet);
+ * CSVFormat format = aFormat.builder().setHeader(resultSet).get();
* </pre>
* <p>
* The header is also used by the {@link CSVPrinter}.
@@ -2783,13 +2788,13 @@ public final class CSVFormat implements Serializable {
* input file with:
*
* <pre>
- * CSVFormat format = aformat.withHeader();
+ * CSVFormat format = aFormat.builder().setHeader().get()
* </pre>
*
* or specified manually with:
*
* <pre>
- * CSVFormat format = aformat.withHeader(metaData);
+ * CSVFormat format = aFormat.builder().setHeader(resultSetMetaData).get()
* </pre>
* <p>
* The header is also used by the {@link CSVPrinter}.
@@ -2811,13 +2816,13 @@ public final class CSVFormat implements Serializable {
* with:
*
* <pre>
- * CSVFormat format = aformat.withHeader();
+ * CSVFormat format = aFormat.builder().setHeader().get();
* </pre>
*
* or specified manually with:
*
* <pre>{@code
- * CSVFormat format = aformat.withHeader("name", "email", "phone");
+ * CSVFormat format = aFormat.builder().setHeader("name", "email", "phone").get();
* }</pre>
* <p>
* The header is also used by the {@link CSVPrinter}.
@@ -2838,7 +2843,7 @@ public final class CSVFormat implements Serializable {
* This setting is ignored by the parser.
*
* <pre>{@code
- * CSVFormat format = aformat.withHeaderComments("Generated by Apache Commons CSV.", Instant.now());
+ * CSVFormat format = aFormat.builder().setHeaderComments("Generated by Apache Commons CSV.", Instant.now()).get();
* }</pre>
*
* @param headerComments the headerComments which will be printed by the Printer before the actual CSV data.