[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:
Gary D. Gregory 2015-08-10 22:47:30 +00:00
parent fd3a9862bd
commit aa0fbb01a0
2 changed files with 13 additions and 0 deletions

View File

@ -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);
}
/**
* 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.
*

View File

@ -27,6 +27,7 @@ public class CSVFormatPredefinedTest {
private void test(final CSVFormat format, final String enumName) {
Assert.assertEquals(format, CSVFormat.Predefined.valueOf(enumName).getFormat());
Assert.assertEquals(format, CSVFormat.valueOf(enumName));
}
@Test