[CSV-157] Add enum CSVFormat.Predefined that contains the default CSVFormat values.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1695179 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fd3a9862bd
commit
aa0fbb01a0
|
@ -364,6 +364,18 @@ public final class CSVFormat implements Serializable {
|
||||||
return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false);
|
return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets one of the predefined formats from {@link CSVFormat.Predefined}.
|
||||||
|
*
|
||||||
|
* @param format
|
||||||
|
* name
|
||||||
|
* @return one of the predefined formats
|
||||||
|
* @since 1.2
|
||||||
|
*/
|
||||||
|
public static CSVFormat valueOf(final String format) {
|
||||||
|
return CSVFormat.Predefined.valueOf(format).getFormat();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a customized CSV format.
|
* Creates a customized CSV format.
|
||||||
*
|
*
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class CSVFormatPredefinedTest {
|
||||||
|
|
||||||
private void test(final CSVFormat format, final String enumName) {
|
private void test(final CSVFormat format, final String enumName) {
|
||||||
Assert.assertEquals(format, CSVFormat.Predefined.valueOf(enumName).getFormat());
|
Assert.assertEquals(format, CSVFormat.Predefined.valueOf(enumName).getFormat());
|
||||||
|
Assert.assertEquals(format, CSVFormat.valueOf(enumName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue