Skip to content

Commit 82b6d2e

Browse files
committed
[CSV-161] Fix Javadoc to say CSVFormat with() methods return a new CSVFormat.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1725409 13f79535-47bb-0310-9956-ffa450edef68
1 parent 8861157 commit 82b6d2e

2 files changed

Lines changed: 30 additions & 26 deletions

File tree

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<action issue="CSV-169" type="add" dev="ggregory" due-to="Gary Gregory">The null string should be case-sensitive when reading records</action>
4545
<action issue="CSV-168" type="fix" dev="ggregory" due-to="Gary Gregory, cornel creanga">CsvFormat.nullString should not be escaped</action>
4646
<action issue="CSV-170" type="fix" dev="ggregory" due-to="Gary Gregory, cornel creanga">CSVFormat.MYSQL nullString should be "\N"</action>
47+
<action issue="CSV-161" type="fix" dev="ggregory" due-to="Gary Gregory, Kristof Meixner, Emmanuel Bourg">Fix Javadoc to say CSVFormat with() methods return a new CSVFormat</action>
4748
</release>
4849
<release version="1.2" date="2015-08-24" description="Feature and bug fix release">
4950
<action issue="CSV-145" type="fix" dev="ggregory" due-to="Frank Ulbricht">CSVFormat.with* methods clear the header comments</action>

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

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ private void validate() throws IllegalArgumentException {
857857
}
858858

859859
/**
860-
* Sets the comment start marker of the format to the specified character.
860+
* Returns a new {@code CSVFormat} with the comment start marker of the format set to the specified character.
861861
*
862862
* Note that the comment start character is only recognized at the start of a line.
863863
*
@@ -872,7 +872,7 @@ public CSVFormat withCommentMarker(final char commentMarker) {
872872
}
873873

874874
/**
875-
* Sets the comment start marker of the format to the specified character.
875+
* Returns a new {@code CSVFormat} with the comment start marker of the format set to the specified character.
876876
*
877877
* Note that the comment start character is only recognized at the start of a line.
878878
*
@@ -892,7 +892,7 @@ public CSVFormat withCommentMarker(final Character commentMarker) {
892892
}
893893

894894
/**
895-
* Sets the delimiter of the format to the specified character.
895+
* Returns a new {@code CSVFormat} with the delimiter of the format set to the specified character.
896896
*
897897
* @param delimiter
898898
* the delimiter character
@@ -910,7 +910,7 @@ public CSVFormat withDelimiter(final char delimiter) {
910910
}
911911

912912
/**
913-
* Sets the escape character of the format to the specified character.
913+
* Returns a new {@code CSVFormat} with the escape character of the format set to the specified character.
914914
*
915915
* @param escape
916916
* the escape character
@@ -923,7 +923,7 @@ public CSVFormat withEscape(final char escape) {
923923
}
924924

925925
/**
926-
* Sets the escape character of the format to the specified character.
926+
* Returns a new {@code CSVFormat} with the escape character of the format set to the specified character.
927927
*
928928
* @param escape
929929
* the escape character, use {@code null} to disable
@@ -941,7 +941,8 @@ public CSVFormat withEscape(final Character escape) {
941941
}
942942

943943
/**
944-
* Sets the header of the format. The header can either be parsed automatically from the input file with:
944+
* Returns a new {@code CSVFormat} with the header of the format set to the given values.
945+
* The header can either be parsed automatically from the input file with:
945946
*
946947
* <pre>
947948
* CSVFormat format = aformat.withHeader();
@@ -969,7 +970,8 @@ public CSVFormat withHeader(final String... header) {
969970
}
970971

971972
/**
972-
* Sets the header of the format. The header can either be parsed automatically from the input file with:
973+
* Returns a new {@code CSVFormat} with the header of the format set from the result set metadata.
974+
* The header can either be parsed automatically from the input file with:
973975
*
974976
* <pre>
975977
* CSVFormat format = aformat.withHeader();
@@ -998,7 +1000,8 @@ public CSVFormat withHeader(final ResultSet resultSet) throws SQLException {
9981000
}
9991001

10001002
/**
1001-
* Sets the header of the format. The header can either be parsed automatically from the input file with:
1003+
* Returns a new {@code CSVFormat} with the header of the format set from the result set metadata.
1004+
* The header can either be parsed automatically from the input file with:
10021005
*
10031006
* <pre>
10041007
* CSVFormat format = aformat.withHeader();
@@ -1037,8 +1040,8 @@ public CSVFormat withHeader(final ResultSetMetaData metaData) throws SQLExceptio
10371040
}
10381041

10391042
/**
1040-
* Sets the header comments of the format. The comments will be printed first, before the headers. This setting is
1041-
* ignored by the parser.
1043+
* Returns a new {@code CSVFormat} with the header comments of the format set to the given values.
1044+
* The comments will be printed first, before the headers. This setting is ignored by the parser.
10421045
*
10431046
* <pre>
10441047
* CSVFormat format = aformat.withHeaderComments(&quot;Generated by Apache Commons CSV 1.1.&quot;, new Date());
@@ -1058,7 +1061,7 @@ public CSVFormat withHeaderComments(final Object... headerComments) {
10581061
}
10591062

10601063
/**
1061-
* Sets the missing column names behavior of the format to {@code true}
1064+
* Returns a new {@code CSVFormat} with the missing column names behavior of the format set to {@code true}
10621065
*
10631066
* @return A new CSVFormat that is equal to this but with the specified missing column names behavior.
10641067
* @see #withAllowMissingColumnNames(boolean)
@@ -1069,7 +1072,7 @@ public CSVFormat withAllowMissingColumnNames() {
10691072
}
10701073

10711074
/**
1072-
* Sets the missing column names behavior of the format.
1075+
* Returns a new {@code CSVFormat} with the missing column names behavior of the format set to the given value.
10731076
*
10741077
* @param allowMissingColumnNames
10751078
* the missing column names behavior, {@code true} to allow missing column names in the header line,
@@ -1083,7 +1086,7 @@ public CSVFormat withAllowMissingColumnNames(final boolean allowMissingColumnNam
10831086
}
10841087

10851088
/**
1086-
* Sets the empty line skipping behavior of the format to {@code true}.
1089+
* Returns a new {@code CSVFormat} with the empty line skipping behavior of the format set to {@code true}.
10871090
*
10881091
* @return A new CSVFormat that is equal to this but with the specified empty line skipping behavior.
10891092
* @since {@link #withIgnoreEmptyLines(boolean)}
@@ -1094,7 +1097,7 @@ public CSVFormat withIgnoreEmptyLines() {
10941097
}
10951098

10961099
/**
1097-
* Sets the empty line skipping behavior of the format.
1100+
* Returns a new {@code CSVFormat} with the empty line skipping behavior of the format set to the given value.
10981101
*
10991102
* @param ignoreEmptyLines
11001103
* the empty line skipping behavior, {@code true} to ignore the empty lines between the records,
@@ -1108,7 +1111,7 @@ public CSVFormat withIgnoreEmptyLines(final boolean ignoreEmptyLines) {
11081111
}
11091112

11101113
/**
1111-
* Sets the trimming behavior of the format to {@code true}.
1114+
* Returns a new {@code CSVFormat} with the trimming behavior of the format set to {@code true}.
11121115
*
11131116
* @return A new CSVFormat that is equal to this but with the specified trimming behavior.
11141117
* @see #withIgnoreSurroundingSpaces(boolean)
@@ -1119,7 +1122,7 @@ public CSVFormat withIgnoreSurroundingSpaces() {
11191122
}
11201123

11211124
/**
1122-
* Sets the trimming behavior of the format.
1125+
* Returns a new {@code CSVFormat} with the trimming behavior of the format set to the given value.
11231126
*
11241127
* @param ignoreSurroundingSpaces
11251128
* the trimming behavior, {@code true} to remove the surrounding spaces, {@code false} to leave the
@@ -1133,7 +1136,7 @@ public CSVFormat withIgnoreSurroundingSpaces(final boolean ignoreSurroundingSpac
11331136
}
11341137

11351138
/**
1136-
* Sets the header ignore case behavior to {@code true}.
1139+
* Returns a new {@code CSVFormat} with the header ignore case behavior set to {@code true}.
11371140
*
11381141
* @return A new CSVFormat that will ignore case header name.
11391142
* @see #withIgnoreHeaderCase(boolean)
@@ -1144,7 +1147,7 @@ public CSVFormat withIgnoreHeaderCase() {
11441147
}
11451148

11461149
/**
1147-
* Sets if header names should be accessed ignoring case.
1150+
* Returns a new {@code CSVFormat} with whether header names should be accessed ignoring case.
11481151
*
11491152
* @param ignoreHeaderCase
11501153
* the case mapping behavior, {@code true} to access name/values, {@code false} to leave the
@@ -1158,7 +1161,7 @@ public CSVFormat withIgnoreHeaderCase(final boolean ignoreHeaderCase) {
11581161
}
11591162

11601163
/**
1161-
* Performs conversions to and from null for strings on input and output.
1164+
* Returns a new {@code CSVFormat} with conversions to and from null for strings on input and output.
11621165
* <ul>
11631166
* <li>
11641167
* <strong>Reading:</strong> Converts strings equal to the given {@code nullString} to {@code null} when reading
@@ -1179,7 +1182,7 @@ public CSVFormat withNullString(final String nullString) {
11791182
}
11801183

11811184
/**
1182-
* Sets the quoteChar of the format to the specified character.
1185+
* Returns a new {@code CSVFormat} with the quoteChar of the format set to the specified character.
11831186
*
11841187
* @param quoteChar
11851188
* the quoteChar character
@@ -1192,7 +1195,7 @@ public CSVFormat withQuote(final char quoteChar) {
11921195
}
11931196

11941197
/**
1195-
* Sets the quoteChar of the format to the specified character.
1198+
* Returns a new {@code CSVFormat} with the quoteChar of the format set to the specified character.
11961199
*
11971200
* @param quoteChar
11981201
* the quoteChar character, use {@code null} to disable
@@ -1210,7 +1213,7 @@ public CSVFormat withQuote(final Character quoteChar) {
12101213
}
12111214

12121215
/**
1213-
* Sets the output quote policy of the format to the specified value.
1216+
* Returns a new {@code CSVFormat} with the output quote policy of the format set to the specified value.
12141217
*
12151218
* @param quoteModePolicy
12161219
* the quote policy to use for output.
@@ -1224,7 +1227,7 @@ public CSVFormat withQuoteMode(final QuoteMode quoteModePolicy) {
12241227
}
12251228

12261229
/**
1227-
* Sets the record separator of the format to the specified character.
1230+
* Returns a new {@code CSVFormat} with the record separator of the format set to the specified character.
12281231
*
12291232
* <p>
12301233
* <strong>Note:</strong> This setting is only used during printing and does not affect parsing. Parsing currently
@@ -1241,7 +1244,7 @@ public CSVFormat withRecordSeparator(final char recordSeparator) {
12411244
}
12421245

12431246
/**
1244-
* Sets the record separator of the format to the specified String.
1247+
* Returns a new {@code CSVFormat} with the record separator of the format set to the specified String.
12451248
*
12461249
* <p>
12471250
* <strong>Note:</strong> This setting is only used during printing and does not affect parsing. Parsing currently
@@ -1262,7 +1265,7 @@ public CSVFormat withRecordSeparator(final String recordSeparator) {
12621265
}
12631266

12641267
/**
1265-
* Sets skipping the header record to {@code true}.
1268+
* Returns a new {@code CSVFormat} with skipping the header record set to {@code true}.
12661269
*
12671270
* @return A new CSVFormat that is equal to this but with the the specified skipHeaderRecord setting.
12681271
* @see #withSkipHeaderRecord(boolean)
@@ -1274,7 +1277,7 @@ public CSVFormat withSkipHeaderRecord() {
12741277
}
12751278

12761279
/**
1277-
* Sets whether to skip the header record.
1280+
* Returns a new {@code CSVFormat} with whether to skip the header record.
12781281
*
12791282
* @param skipHeaderRecord
12801283
* whether to skip the header record.

0 commit comments

Comments
 (0)