commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r1199768 - /commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java
Date Wed, 09 Nov 2011 14:16:22 GMT
Author: ebourg
Date: Wed Nov  9 14:16:22 2011
New Revision: 1199768

URL: http://svn.apache.org/viewvc?rev=1199768&view=rev
Log:
Made the static fields final in CSVStrategy

Modified:
    commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java

Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java?rev=1199768&r1=1199767&r2=1199768&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java (original)
+++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVStrategy.java Wed Nov
 9 14:16:22 2011
@@ -41,16 +41,13 @@ public class CSVStrategy implements Clon
     // an EOF signal (-1), and because \ufffe in UTF-16 would be
     // encoded as two chars (using surrogates) and thus there should never
     // be a collision with a real text char.
-    public static char COMMENTS_DISABLED = (char) -2;
-    public static char ESCAPE_DISABLED = (char) -2;
-    public static char ENCAPSULATOR_DISABLED = (char) -2;
-
-    public static CSVStrategy DEFAULT_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED,
ESCAPE_DISABLED, true,
-            true, false, true);
-    public static CSVStrategy EXCEL_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED,
ESCAPE_DISABLED, false,
-            false, false, false);
-    public static CSVStrategy TDF_STRATEGY = new CSVStrategy('\t', '"', COMMENTS_DISABLED,
ESCAPE_DISABLED, true,
-            true, false, true);
+    public static final char COMMENTS_DISABLED = (char) -2;
+    public static final char ESCAPE_DISABLED = (char) -2;
+    public static final char ENCAPSULATOR_DISABLED = (char) -2;
+
+    public static final CSVStrategy DEFAULT_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED,
ESCAPE_DISABLED, true, true, false, true);
+    public static final CSVStrategy EXCEL_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED,
ESCAPE_DISABLED, false, false, false, false);
+    public static final CSVStrategy TDF_STRATEGY = new CSVStrategy('\t', '"', COMMENTS_DISABLED,
ESCAPE_DISABLED, true, true, false, true);
 
 
     public CSVStrategy(char delimiter, char encapsulator, char commentStart) {
@@ -58,37 +55,34 @@ public class CSVStrategy implements Clon
     }
 
     /**
-     * Customized CSV strategy setter.
+     * Customized CSV strategy constructor.
      *
-     * @param delimiter                a Char used for value separation
-     * @param encapsulator             a Char used as value encapsulation marker
-     * @param commentStart             a Char used for comment identification
-     * @param escape                   a Char used to escape special characters in values
-     * @param ignoreLeadingWhitespace  TRUE when leading whitespaces should be
-     *                                 ignored
-     * @param ignoreTrailingWhitespace TRUE when trailing whitespaces should be
-     *                                 ignored
-     * @param interpretUnicodeEscapes  TRUE when unicode escapes should be
-     *                                 interpreted
-     * @param ignoreEmptyLines         TRUE when the parser should skip emtpy lines
+     * @param delimiter                 a char used for value separation
+     * @param encapsulator              a char used as value encapsulation marker
+     * @param commentStart              a char used for comment identification
+     * @param escape                    a char used to escape special characters in values
+     * @param ignoreLeadingWhitespaces  TRUE when leading whitespaces should be ignored
+     * @param ignoreTrailingWhitespaces TRUE when trailing whitespaces should be ignored
+     * @param interpretUnicodeEscapes   TRUE when unicode escapes should be interpreted
+     * @param ignoreEmptyLines          TRUE when the parser should skip emtpy lines
      */
     public CSVStrategy(
             char delimiter,
             char encapsulator,
             char commentStart,
             char escape,
-            boolean ignoreLeadingWhitespace,
-            boolean ignoreTrailingWhitespace,
+            boolean ignoreLeadingWhitespaces,
+            boolean ignoreTrailingWhitespaces,
             boolean interpretUnicodeEscapes,
             boolean ignoreEmptyLines) {
-        setDelimiter(delimiter);
-        setEncapsulator(encapsulator);
-        setCommentStart(commentStart);
-        setEscape(escape);
-        setIgnoreLeadingWhitespaces(ignoreLeadingWhitespace);
-        setIgnoreTrailingWhitespaces(ignoreTrailingWhitespace);
-        setUnicodeEscapeInterpretation(interpretUnicodeEscapes);
-        setIgnoreEmptyLines(ignoreEmptyLines);
+        this.delimiter = delimiter;
+        this.encapsulator = encapsulator;
+        this.commentStart = commentStart;
+        this.escape = escape;
+        this.ignoreLeadingWhitespaces = ignoreLeadingWhitespaces;
+        this.ignoreTrailingWhitespaces = ignoreTrailingWhitespaces;
+        this.interpretUnicodeEscapes = interpretUnicodeEscapes;
+        this.ignoreEmptyLines = ignoreEmptyLines;
     }
 
     /**
@@ -98,10 +92,10 @@ public class CSVStrategy implements Clon
             char delimiter,
             char encapsulator,
             char commentStart,
-            boolean ignoreLeadingWhitespace,
+            boolean ignoreLeadingWhitespaces,
             boolean interpretUnicodeEscapes,
             boolean ignoreEmptyLines) {
-        this(delimiter, encapsulator, commentStart, CSVStrategy.ESCAPE_DISABLED, ignoreLeadingWhitespace,
+        this(delimiter, encapsulator, commentStart, CSVStrategy.ESCAPE_DISABLED, ignoreLeadingWhitespaces,
                 true, interpretUnicodeEscapes, ignoreEmptyLines);
     }
 
@@ -165,18 +159,10 @@ public class CSVStrategy implements Clon
         return this.interpretUnicodeEscapes;
     }
 
-    public void setIgnoreEmptyLines(boolean ignoreEmptyLines) {
-        this.ignoreEmptyLines = ignoreEmptyLines;
-    }
-
     public boolean getIgnoreEmptyLines() {
         return this.ignoreEmptyLines;
     }
 
-    public void setPrinterNewline(String newline) {
-        this.printerNewline = newline;
-    }
-
     public String getPrinterNewline() {
         return this.printerNewline;
     }



Mime
View raw message