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 2016/05/09 14:23:57 UTC

svn commit: r1742957 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java

Author: ggregory
Date: Mon May  9 14:23:57 2016
New Revision: 1742957

URL: http://svn.apache.org/viewvc?rev=1742957&view=rev
Log:
Sort 1 method into place.

Modified:
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.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=1742957&r1=1742956&r2=1742957&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 May  9 14:23:57 2016
@@ -1097,6 +1097,41 @@ public final class CSVFormat implements
     }
 
     /**
+     * Returns a new {@code CSVFormat} with the header of the format defined by the enum class:
+     *
+     * <pre>
+     * public enum Header {
+     *     Name, Email, Phone
+     * }
+     *
+     * CSVFormat format = aformat.withHeader(Header.class);
+     * </pre>
+     * <p>
+     * The header is also used by the {@link CSVPrinter}..
+     * </p>
+     *
+     * @param headerEnum
+     *              the enum defining the header, {@code null} if disabled, empty if parsed automatically, user
+     *              specified otherwise.
+     *
+     * @return A new CSVFormat that is equal to this but with the specified header
+     * @see #withHeader(String...)
+     * @see #withSkipHeaderRecord(boolean)
+     * @since 1.3
+     */
+    public CSVFormat withHeader(final Class<? extends Enum<?>> headerEnum) {
+        String[] header = null;
+        if (headerEnum != null) {
+            Enum<?>[] enumValues = headerEnum.getEnumConstants();
+            header = new String[enumValues.length];
+            for (int i = 0; i < enumValues.length; i++) {
+                header[i] = enumValues[i].name();
+            }
+        }
+        return withHeader(header);
+    }
+
+    /**
      * Returns a new {@code CSVFormat} with the header of the format set from the result set metadata. The header can
      * either be parsed automatically from the input file with:
      *
@@ -1194,41 +1229,6 @@ public final class CSVFormat implements
     }
 
     /**
-     * Returns a new {@code CSVFormat} with the header of the format defined by the enum class:
-     *
-     * <pre>
-     * public enum Header {
-     *     Name, Email, Phone
-     * }
-     *
-     * CSVFormat format = aformat.withHeader(Header.class);
-     * </pre>
-     * <p>
-     * The header is also used by the {@link CSVPrinter}..
-     * </p>
-     *
-     * @param headerEnum
-     *              the enum defining the header, {@code null} if disabled, empty if parsed automatically, user
-     *              specified otherwise.
-     *
-     * @return A new CSVFormat that is equal to this but with the specified header
-     * @see #withHeader(String...)
-     * @see #withSkipHeaderRecord(boolean)
-     * @since 1.3
-     */
-    public CSVFormat withHeader(final Class<? extends Enum<?>> headerEnum) {
-        String[] header = null;
-        if (headerEnum != null) {
-            Enum<?>[] enumValues = headerEnum.getEnumConstants();
-            header = new String[enumValues.length];
-            for (int i = 0; i < enumValues.length; i++) {
-                header[i] = enumValues[i].name();
-            }
-        }
-        return withHeader(header);
-    }
-
-    /**
      * Returns a new {@code CSVFormat} with the header comments of the format set to the given values. The comments will
      * be printed first, before the headers. This setting is ignored by the parser.
      *