Now that delimiter is a char, simplify API by removing withDelimiter(Character)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1398349 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ae5e7898f5
commit
7c770e0b53
|
@ -171,7 +171,19 @@ public class CSVFormat implements Serializable {
|
||||||
* @return true if <code>c</code> is a line break character
|
* @return true if <code>c</code> is a line break character
|
||||||
*/
|
*/
|
||||||
private static boolean isLineBreak(final Character c) {
|
private static boolean isLineBreak(final Character c) {
|
||||||
return c != null && (c == LF || c == CR);
|
return c != null && isLineBreak(c.charValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given character is a line break character.
|
||||||
|
*
|
||||||
|
* @param c
|
||||||
|
* the character to check
|
||||||
|
*
|
||||||
|
* @return true if <code>c</code> is a line break character
|
||||||
|
*/
|
||||||
|
private static boolean isLineBreak(final char c) {
|
||||||
|
return c == LF || c == CR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -226,19 +238,6 @@ public class CSVFormat implements Serializable {
|
||||||
* thrown if the specified character is a line break
|
* thrown if the specified character is a line break
|
||||||
*/
|
*/
|
||||||
public CSVFormat withDelimiter(final char delimiter) {
|
public CSVFormat withDelimiter(final char delimiter) {
|
||||||
return withDelimiter(Character.valueOf(delimiter));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a copy of this format using the specified delimiter character.
|
|
||||||
*
|
|
||||||
* @param delimiter
|
|
||||||
* the delimiter character
|
|
||||||
* @return A copy of this format using the specified delimiter character
|
|
||||||
* @throws IllegalArgumentException
|
|
||||||
* thrown if the specified character is a line break
|
|
||||||
*/
|
|
||||||
public CSVFormat withDelimiter(final Character delimiter) {
|
|
||||||
if (isLineBreak(delimiter)) {
|
if (isLineBreak(delimiter)) {
|
||||||
throw new IllegalArgumentException("The delimiter cannot be a line break");
|
throw new IllegalArgumentException("The delimiter cannot be a line break");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue