You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2014/07/14 21:07:28 UTC

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

Author: britter
Date: Mon Jul 14 19:07:28 2014
New Revision: 1610485

URL: http://svn.apache.org/r1610485
Log:
Make JavaDoc more readable and clear up field values of CSVFormats

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=1610485&r1=1610484&r2=1610485&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 Jul 14 19:07:28 2014
@@ -161,28 +161,30 @@ public final class CSVFormat implements 
 
     /**
      * Standard comma separated format, as for {@link #RFC4180} but allowing empty lines.
-     * <h3>RFC 4180:</h3>
-     * <ul>
-     * <li>withDelimiter(',')</li>
-     * <li>withQuoteChar('"')</li>
-     * <li>withRecordSeparator(CRLF)</li>
-     * </ul>
-     * <h3>Additional:</h3>
+     *
+     * <p>Settings are:
      * <ul>
-     * <li>withIgnoreEmptyLines(true)</li>
+     *   <li>withDelimiter(',')</li>
+     *   <li>withQuoteChar('"')</li>
+     *   <li>withRecordSeparator("\r\n")</li>
+     *   <li>withIgnoreEmptyLines(true)</li>
      * </ul>
+     * </p>
      */
     public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null,
                                                             false, true, CRLF, null, null, false, false);
 
     /**
      * Comma separated format as defined by <a href="http://tools.ietf.org/html/rfc4180">RFC 4180</a>.
-     * <h3>RFC 4180:</h3>
+     *
+     * <p>Settings are:
      * <ul>
-     * <li>withDelimiter(',')</li>
-     * <li>withQuoteChar('"')</li>
-     * <li>withRecordSeparator(CRLF)</li>
+     *   <li>withDelimiter(',')</li>
+     *   <li>withQuoteChar('"')</li>
+     *   <li>withRecordSeparator("\r\n")</li>
+     *   <li>withIgnoreEmptyLines(false)</li>
      * </ul>
+     * </p>
      */
     public static final CSVFormat RFC4180 = DEFAULT.withIgnoreEmptyLines(false);
 
@@ -195,32 +197,59 @@ public final class CSVFormat implements 
      * </p>
      *
      * <pre>
-     * CSVFormat fmt = CSVFormat.newBuilder(EXCEL).withDelimiter(';');
+     * CSVFormat fmt = CSVFormat.EXCEL.withDelimiter(';');
      * </pre>
      *
      * <p>
      * Settings are:
-     * </p>
      * <ul>
-     * <li>withDelimiter(',')</li>
-     * <li>withQuoteChar('"')</li>
-     * <li>withRecordSeparator(CRLF)</li>
+     *   <li>withDelimiter(',')</li>
+     *   <li>withQuoteChar('"')</li>
+     *   <li>withRecordSeparator("\r\n")</li>
+     *   <li>withIgnoreEmptyLines(false)</li>
      * </ul>
-     * Note: this is currently the same as RFC4180
+     * </p>
+     * <p>
+     * Note: this is currently the same as {@link #RFC4180}.
+     * </p>
      */
     public static final CSVFormat EXCEL = DEFAULT.withIgnoreEmptyLines(false);
 
-    /** Tab-delimited format, with quote; leading and trailing spaces ignored. */
+    /**
+     * Tab-delimited format.
+     *
+     * <p>Settings are:
+     * <ul>
+     *   <li>withDelimiter('\t')</li>
+     *   <li>withQuoteChar('"')</li>
+     *   <li>withRecordSeparator("\r\n")</li>
+     *   <li>withIgnoreSurroundingSpaces(true)</li>
+     * </ul>
+     * </p>
+     */
     public static final CSVFormat TDF =
             DEFAULT
             .withDelimiter(TAB)
             .withIgnoreSurroundingSpaces(true);
 
     /**
-     * Default MySQL format used by the <tt>SELECT INTO OUTFILE</tt> and <tt>LOAD DATA INFILE</tt> operations. This is
-     * a tab-delimited format with a LF character as the line separator. Values are not quoted and special characters
+     * Default MySQL format used by the <tt>SELECT INTO OUTFILE</tt> and <tt>LOAD DATA INFILE</tt> operations.
+     *
+     * <p>
+     * This is a tab-delimited format with a LF character as the line separator. Values are not quoted and special characters
      * are escaped with '\'.
+     * </p>
      *
+     * <p>
+     * Settings are:
+     * <ul>
+     *   <li>withDelimiter('\t')</li>
+     *   <li>withQuoteChar(null)</li>
+     *   <li>withRecordSeparator('\n')</li>
+     *   <li>withIgnoreEmptyLines(false)</li>
+     *   <li>withEscape('\\')</li>
+     * </ul>
+     * </p>
      * @see <a href="http://dev.mysql.com/doc/refman/5.1/en/load-data.html">
      *      http://dev.mysql.com/doc/refman/5.1/en/load-data.html</a>
      */
@@ -259,10 +288,19 @@ public final class CSVFormat implements 
     /**
      * Creates a new CSV format with the specified delimiter.
      *
+     * <p>Use this method if you want to create a CSVFormat from scratch. All fields but the delimiter will be
+     * initialized with null/false.</p>
+     *
      * @param delimiter
      *            the char used for value separation, must not be a line break character
      * @return a new CSV format.
      * @throws IllegalArgumentException if the delimiter is a line break character
+     *
+     * @see #DEFAULT
+     * @see #RFC4180
+     * @see #MYSQL
+     * @see #EXCEL
+     * @see #TDF
      */
     public static CSVFormat newFormat(final char delimiter) {
         return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, false, false);