You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2015/08/11 00:47:30 UTC

svn commit: r1695179 - in /commons/proper/csv/trunk/src: main/java/org/apache/commons/csv/CSVFormat.java test/java/org/apache/commons/csv/CSVFormatPredefinedTest.java

Author: ggregory
Date: Mon Aug 10 22:47:30 2015
New Revision: 1695179

URL: http://svn.apache.org/r1695179
Log:
[CSV-157] Add enum CSVFormat.Predefined that contains the default CSVFormat values.

Modified:
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatPredefinedTest.java

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1695179&r1=1695178&r2=1695179&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Mon Aug 10 22:47:30 2015
@@ -365,6 +365,18 @@ public final class CSVFormat implements
     }
 
     /**
+     * Gets one of the predefined formats from {@link CSVFormat.Predefined}.
+     * 
+     * @param format
+     *            name
+     * @return one of the predefined formats
+     * @since 1.2
+     */
+    public static CSVFormat valueOf(final String format) {
+        return CSVFormat.Predefined.valueOf(format).getFormat();
+    }
+
+    /**
      * Creates a customized CSV format.
      *
      * @param delimiter

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatPredefinedTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatPredefinedTest.java?rev=1695179&r1=1695178&r2=1695179&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatPredefinedTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatPredefinedTest.java Mon Aug 10 22:47:30 2015
@@ -27,6 +27,7 @@ public class CSVFormatPredefinedTest {
 
     private void test(final CSVFormat format, final String enumName) {
         Assert.assertEquals(format, CSVFormat.Predefined.valueOf(enumName).getFormat());
+        Assert.assertEquals(format, CSVFormat.valueOf(enumName));
     }
 
     @Test