Author: ggregory
Date: Sun Oct 14 04:31:39 2012
New Revision: 1398005

URL: http://svn.apache.org/viewvc?rev=1398005&view=rev
Log:
Change the type of printer API to accept Object instead of String.

Modified:
    
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java

Modified: 
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
URL: 
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java?rev=1398005&r1=1398004&r2=1398005&view=diff
==============================================================================
--- 
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java 
(original)
+++ 
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java 
Sun Oct 14 04:31:39 2012
@@ -87,8 +87,8 @@ public class CSVPrinter {
      * @param values
      *            values to be outputted.
      */
-    public void println(final String... values) throws IOException {
-        for (final String value : values) {
+    public void println(final Object... values) throws IOException {
+        for (final Object value : values) {
             print(value);
         }
         println();
@@ -280,15 +280,12 @@ public class CSVPrinter {
      * Prints the string as the next value on the line. The value will be 
escaped or encapsulated as needed if
      * checkForEscape==true
      *
-     * @param value
+     * @param object
      *            value to output.
      */
-    public void print(String value, final boolean checkForEscape) throws 
IOException {
-        if (value == null) {
-            // null values are considered empty
-            value = EMPTY;
-        }
-
+    public void print(Object object, final boolean checkForEscape) throws 
IOException {
+        // null values are considered empty
+        final String value = object == null ? EMPTY : object.toString();
         if (!checkForEscape) {
             // write directly from string
             printDelimiter();
@@ -302,9 +299,9 @@ public class CSVPrinter {
      * Prints the string as the next value on the line. The value will be 
escaped or encapsulated as needed.
      *
      * @param value
-     *            value to be outputted.
+     *            value to be output.
      */
-    public void print(final String value) throws IOException {
+    public void print(final Object value) throws IOException {
         print(value, true);
     }
 }


Reply via email to