Skip to content

Commit 15a38a4

Browse files
committed
Javadoc: Don't use deprecated code
1 parent 03d2375 commit 15a38a4

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

src/main/java/org/apache/commons/csv/CSVFormat.java

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
* </p>
9494
*
9595
* <pre>{@code
96-
* CSVFormat.EXCEL.withNullString("N/A").withIgnoreSurroundingSpaces(true);
96+
* CSVFormat.EXCEL.builder().setNullString("N/A").setIgnoreSurroundingSpaces(true).get();
9797
* }</pre>
9898
*
9999
* <h2>Defining column names</h2>
@@ -103,7 +103,7 @@
103103
* </p>
104104
*
105105
* <pre>{@code
106-
* CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3");
106+
* CSVFormat.EXCEL.builder().setHeader("Col1", "Col2", "Col3").get();
107107
* }</pre>
108108
*
109109
* <p>
@@ -122,7 +122,7 @@
122122
*
123123
* <pre>{@code
124124
* Reader in = ...;
125-
* CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3").parse(in);
125+
* CSVFormat.EXCEL.builder().setHeader("Col1", "Col2", "Col3").get().parse(in);
126126
* }</pre>
127127
*
128128
* <p>
@@ -137,7 +137,7 @@
137137
* </p>
138138
*
139139
* <pre>
140-
* CSVFormat.EXCEL.withHeader();
140+
* CSVFormat.EXCEL.builder().setHeader().get();
141141
* </pre>
142142
*
143143
* <p>
@@ -993,7 +993,7 @@ public CSVFormat getFormat() {
993993
* </p>
994994
*
995995
* <pre>
996-
* CSVFormat fmt = CSVFormat.EXCEL.withDelimiter(';');
996+
* CSVFormat fmt = CSVFormat.EXCEL.builder().setDelimiter(';').get();
997997
* </pre>
998998
*
999999
* <p>
@@ -2693,6 +2693,7 @@ public CSVFormat withEscape(final Character escape) {
26932693
return builder().setEscape(escape).get();
26942694
}
26952695

2696+
// @formatter:off
26962697
/**
26972698
* Builds a new {@code CSVFormat} using the first record as header.
26982699
*
@@ -2701,7 +2702,10 @@ public CSVFormat withEscape(final Character escape) {
27012702
* </p>
27022703
*
27032704
* <pre>
2704-
* CSVFormat format = aFormat.withHeader().withSkipHeaderRecord();
2705+
* CSVFormat format = aFormat.builder()
2706+
* .setHeader()
2707+
* .setSkipHeaderRecord(true)
2708+
* .get();
27052709
* </pre>
27062710
*
27072711
* @return A new CSVFormat that is equal to this but using the first record as header.
@@ -2710,6 +2714,7 @@ public CSVFormat withEscape(final Character escape) {
27102714
* @since 1.3
27112715
* @deprecated Use {@link Builder#setHeader(String...) Builder#setHeader()}.{@link Builder#setSkipHeaderRecord(boolean) setSkipHeaderRecord(true)}.
27122716
*/
2717+
// @formatter:on
27132718
@Deprecated
27142719
public CSVFormat withFirstRecordAsHeader() {
27152720
// @formatter:off
@@ -2728,11 +2733,11 @@ public CSVFormat withFirstRecordAsHeader() {
27282733
* </p>
27292734
*
27302735
* <pre>
2731-
* public enum Header {
2736+
* public enum MyHeader {
27322737
* Name, Email, Phone
27332738
* }
2734-
*
2735-
* CSVFormat format = aformat.withHeader(Header.class);
2739+
* ...
2740+
* CSVFormat format = aFormat.builder().setHeader(MyHeader.class).get();
27362741
* </pre>
27372742
* <p>
27382743
* The header is also used by the {@link CSVPrinter}.
@@ -2755,13 +2760,13 @@ public CSVFormat withHeader(final Class<? extends Enum<?>> headerEnum) {
27552760
* input file with:
27562761
*
27572762
* <pre>
2758-
* CSVFormat format = aformat.withHeader();
2763+
* CSVFormat format = aFormat.builder().setHeader().get();
27592764
* </pre>
27602765
*
27612766
* or specified manually with:
27622767
*
27632768
* <pre>
2764-
* CSVFormat format = aformat.withHeader(resultSet);
2769+
* CSVFormat format = aFormat.builder().setHeader(resultSet).get();
27652770
* </pre>
27662771
* <p>
27672772
* The header is also used by the {@link CSVPrinter}.
@@ -2783,13 +2788,13 @@ public CSVFormat withHeader(final ResultSet resultSet) throws SQLException {
27832788
* input file with:
27842789
*
27852790
* <pre>
2786-
* CSVFormat format = aformat.withHeader();
2791+
* CSVFormat format = aFormat.builder().setHeader().get()
27872792
* </pre>
27882793
*
27892794
* or specified manually with:
27902795
*
27912796
* <pre>
2792-
* CSVFormat format = aformat.withHeader(metaData);
2797+
* CSVFormat format = aFormat.builder().setHeader(resultSetMetaData).get()
27932798
* </pre>
27942799
* <p>
27952800
* The header is also used by the {@link CSVPrinter}.
@@ -2811,13 +2816,13 @@ public CSVFormat withHeader(final ResultSetMetaData resultSetMetaData) throws SQ
28112816
* with:
28122817
*
28132818
* <pre>
2814-
* CSVFormat format = aformat.withHeader();
2819+
* CSVFormat format = aFormat.builder().setHeader().get();
28152820
* </pre>
28162821
*
28172822
* or specified manually with:
28182823
*
28192824
* <pre>{@code
2820-
* CSVFormat format = aformat.withHeader("name", "email", "phone");
2825+
* CSVFormat format = aFormat.builder().setHeader("name", "email", "phone").get();
28212826
* }</pre>
28222827
* <p>
28232828
* The header is also used by the {@link CSVPrinter}.
@@ -2838,7 +2843,7 @@ public CSVFormat withHeader(final String... header) {
28382843
* This setting is ignored by the parser.
28392844
*
28402845
* <pre>{@code
2841-
* CSVFormat format = aformat.withHeaderComments("Generated by Apache Commons CSV.", Instant.now());
2846+
* CSVFormat format = aFormat.builder().setHeaderComments("Generated by Apache Commons CSV.", Instant.now()).get();
28422847
* }</pre>
28432848
*
28442849
* @param headerComments the headerComments which will be printed by the Printer before the actual CSV data.

0 commit comments

Comments
 (0)