Skip to content

Commit 43b777b

Browse files
committed
Made the static fields final in CSVStrategy
git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1199768 13f79535-47bb-0310-9956-ffa450edef68
1 parent e6e8074 commit 43b777b

1 file changed

Lines changed: 27 additions & 41 deletions

File tree

src/main/java/org/apache/commons/csv/CSVStrategy.java

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -41,54 +41,48 @@ public class CSVStrategy implements Cloneable, Serializable {
4141
// an EOF signal (-1), and because \ufffe in UTF-16 would be
4242
// encoded as two chars (using surrogates) and thus there should never
4343
// be a collision with a real text char.
44-
public static char COMMENTS_DISABLED = (char) -2;
45-
public static char ESCAPE_DISABLED = (char) -2;
46-
public static char ENCAPSULATOR_DISABLED = (char) -2;
44+
public static final char COMMENTS_DISABLED = (char) -2;
45+
public static final char ESCAPE_DISABLED = (char) -2;
46+
public static final char ENCAPSULATOR_DISABLED = (char) -2;
4747

48-
public static CSVStrategy DEFAULT_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true,
49-
true, false, true);
50-
public static CSVStrategy EXCEL_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, false,
51-
false, false, false);
52-
public static CSVStrategy TDF_STRATEGY = new CSVStrategy('\t', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true,
53-
true, false, true);
48+
public static final CSVStrategy DEFAULT_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true);
49+
public static final CSVStrategy EXCEL_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, false, false, false, false);
50+
public static final CSVStrategy TDF_STRATEGY = new CSVStrategy('\t', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true);
5451

5552

5653
public CSVStrategy(char delimiter, char encapsulator, char commentStart) {
5754
this(delimiter, encapsulator, commentStart, true, false, true);
5855
}
5956

6057
/**
61-
* Customized CSV strategy setter.
58+
* Customized CSV strategy constructor.
6259
*
63-
* @param delimiter a Char used for value separation
64-
* @param encapsulator a Char used as value encapsulation marker
65-
* @param commentStart a Char used for comment identification
66-
* @param escape a Char used to escape special characters in values
67-
* @param ignoreLeadingWhitespace TRUE when leading whitespaces should be
68-
* ignored
69-
* @param ignoreTrailingWhitespace TRUE when trailing whitespaces should be
70-
* ignored
71-
* @param interpretUnicodeEscapes TRUE when unicode escapes should be
72-
* interpreted
73-
* @param ignoreEmptyLines TRUE when the parser should skip emtpy lines
60+
* @param delimiter a char used for value separation
61+
* @param encapsulator a char used as value encapsulation marker
62+
* @param commentStart a char used for comment identification
63+
* @param escape a char used to escape special characters in values
64+
* @param ignoreLeadingWhitespaces TRUE when leading whitespaces should be ignored
65+
* @param ignoreTrailingWhitespaces TRUE when trailing whitespaces should be ignored
66+
* @param interpretUnicodeEscapes TRUE when unicode escapes should be interpreted
67+
* @param ignoreEmptyLines TRUE when the parser should skip emtpy lines
7468
*/
7569
public CSVStrategy(
7670
char delimiter,
7771
char encapsulator,
7872
char commentStart,
7973
char escape,
80-
boolean ignoreLeadingWhitespace,
81-
boolean ignoreTrailingWhitespace,
74+
boolean ignoreLeadingWhitespaces,
75+
boolean ignoreTrailingWhitespaces,
8276
boolean interpretUnicodeEscapes,
8377
boolean ignoreEmptyLines) {
84-
setDelimiter(delimiter);
85-
setEncapsulator(encapsulator);
86-
setCommentStart(commentStart);
87-
setEscape(escape);
88-
setIgnoreLeadingWhitespaces(ignoreLeadingWhitespace);
89-
setIgnoreTrailingWhitespaces(ignoreTrailingWhitespace);
90-
setUnicodeEscapeInterpretation(interpretUnicodeEscapes);
91-
setIgnoreEmptyLines(ignoreEmptyLines);
78+
this.delimiter = delimiter;
79+
this.encapsulator = encapsulator;
80+
this.commentStart = commentStart;
81+
this.escape = escape;
82+
this.ignoreLeadingWhitespaces = ignoreLeadingWhitespaces;
83+
this.ignoreTrailingWhitespaces = ignoreTrailingWhitespaces;
84+
this.interpretUnicodeEscapes = interpretUnicodeEscapes;
85+
this.ignoreEmptyLines = ignoreEmptyLines;
9286
}
9387

9488
/**
@@ -98,10 +92,10 @@ public CSVStrategy(
9892
char delimiter,
9993
char encapsulator,
10094
char commentStart,
101-
boolean ignoreLeadingWhitespace,
95+
boolean ignoreLeadingWhitespaces,
10296
boolean interpretUnicodeEscapes,
10397
boolean ignoreEmptyLines) {
104-
this(delimiter, encapsulator, commentStart, CSVStrategy.ESCAPE_DISABLED, ignoreLeadingWhitespace,
98+
this(delimiter, encapsulator, commentStart, CSVStrategy.ESCAPE_DISABLED, ignoreLeadingWhitespaces,
10599
true, interpretUnicodeEscapes, ignoreEmptyLines);
106100
}
107101

@@ -165,18 +159,10 @@ public boolean getUnicodeEscapeInterpretation() {
165159
return this.interpretUnicodeEscapes;
166160
}
167161

168-
public void setIgnoreEmptyLines(boolean ignoreEmptyLines) {
169-
this.ignoreEmptyLines = ignoreEmptyLines;
170-
}
171-
172162
public boolean getIgnoreEmptyLines() {
173163
return this.ignoreEmptyLines;
174164
}
175165

176-
public void setPrinterNewline(String newline) {
177-
this.printerNewline = newline;
178-
}
179-
180166
public String getPrinterNewline() {
181167
return this.printerNewline;
182168
}

0 commit comments

Comments
 (0)