Skip to content

Commit

Permalink
Javadoc: Don't use deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jan 3, 2025
1 parent 03d2375 commit 15a38a4
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/main/java/org/apache/commons/csv/CSVFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
* </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>
Expand All @@ -103,7 +103,7 @@
* </p>
*
* <pre>{@code
* CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3");
* CSVFormat.EXCEL.builder().setHeader("Col1", "Col2", "Col3").get();
* }</pre>
*
* <p>
Expand All @@ -122,7 +122,7 @@
*
* <pre>{@code
* Reader in = ...;
* CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3").parse(in);
* CSVFormat.EXCEL.builder().setHeader("Col1", "Col2", "Col3").get().parse(in);
* }</pre>
*
* <p>
Expand All @@ -137,7 +137,7 @@
* </p>
*
* <pre>
* CSVFormat.EXCEL.withHeader();
* CSVFormat.EXCEL.builder().setHeader().get();
* </pre>
*
* <p>
Expand Down Expand Up @@ -993,7 +993,7 @@ public CSVFormat getFormat() {
* </p>
*
* <pre>
* CSVFormat fmt = CSVFormat.EXCEL.withDelimiter(';');
* CSVFormat fmt = CSVFormat.EXCEL.builder().setDelimiter(';').get();
* </pre>
*
* <p>
Expand Down Expand Up @@ -2693,6 +2693,7 @@ public CSVFormat withEscape(final Character escape) {
return builder().setEscape(escape).get();
}

// @formatter:off
/**
* Builds a new {@code CSVFormat} using the first record as header.
*
Expand All @@ -2701,7 +2702,10 @@ public CSVFormat withEscape(final Character escape) {
* </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.
Expand All @@ -2710,6 +2714,7 @@ public CSVFormat withEscape(final Character escape) {
* @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
Expand All @@ -2728,11 +2733,11 @@ public CSVFormat withFirstRecordAsHeader() {
* </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}.
Expand All @@ -2755,13 +2760,13 @@ public CSVFormat withHeader(final Class<? extends Enum<?>> headerEnum) {
* 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}.
Expand All @@ -2783,13 +2788,13 @@ public CSVFormat withHeader(final ResultSet resultSet) throws SQLException {
* 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}.
Expand All @@ -2811,13 +2816,13 @@ public CSVFormat withHeader(final ResultSetMetaData resultSetMetaData) throws SQ
* 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}.
Expand All @@ -2838,7 +2843,7 @@ public CSVFormat withHeader(final String... header) {
* 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.
Expand Down

0 comments on commit 15a38a4

Please sign in to comment.