Skip to content

Commit 3be1057

Browse files
committed
Change the type of printer API to accept Object instead of String.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1398005 13f79535-47bb-0310-9956-ffa450edef68
1 parent 68322e0 commit 3be1057

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public void flush() throws IOException {
8787
* @param values
8888
* values to be outputted.
8989
*/
90-
public void println(final String... values) throws IOException {
91-
for (final String value : values) {
90+
public void println(final Object... values) throws IOException {
91+
for (final Object value : values) {
9292
print(value);
9393
}
9494
println();
@@ -280,15 +280,12 @@ void printAndEncapsulate(final CharSequence value, final int offset, final int l
280280
* Prints the string as the next value on the line. The value will be escaped or encapsulated as needed if
281281
* checkForEscape==true
282282
*
283-
* @param value
283+
* @param object
284284
* value to output.
285285
*/
286-
public void print(String value, final boolean checkForEscape) throws IOException {
287-
if (value == null) {
288-
// null values are considered empty
289-
value = EMPTY;
290-
}
291-
286+
public void print(Object object, final boolean checkForEscape) throws IOException {
287+
// null values are considered empty
288+
final String value = object == null ? EMPTY : object.toString();
292289
if (!checkForEscape) {
293290
// write directly from string
294291
printDelimiter();
@@ -302,9 +299,9 @@ public void print(String value, final boolean checkForEscape) throws IOException
302299
* Prints the string as the next value on the line. The value will be escaped or encapsulated as needed.
303300
*
304301
* @param value
305-
* value to be outputted.
302+
* value to be output.
306303
*/
307-
public void print(final String value) throws IOException {
304+
public void print(final Object value) throws IOException {
308305
print(value, true);
309306
}
310307
}

0 commit comments

Comments
 (0)