On Sun, Mar 24, 2013 at 8:30 AM, sebb <[email protected]> wrote: > On 24 March 2013 02:02, <[email protected]> wrote: > > Author: ggregory > > Date: Sun Mar 24 02:02:11 2013 > > New Revision: 1460254 > > > > URL: http://svn.apache.org/r1460254 > > Log: > > Add a toBuilder method to do: > > CSVFormat format = CSVFormat.EXCEL.toBuilder().withHeader("Col1", > "Col2", "Col3").build(); > > Instead of: > > CSVFormat format = > CSVFormat.newBuilder(CSVFormat.EXCEL).withHeader("Col1", "Col2", > "Col3").build(); > > The new syntax needs to be documented somewhere please. > e.g. classs Javadoc >
Ah, yes, good point, thank you. Done. Gary > > > Modified: > > > commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java > > > commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatBuilderTest.java > > > > Modified: > commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java > > URL: > http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1460254&r1=1460253&r2=1460254&view=diff > > > ============================================================================== > > --- > commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java > (original) > > +++ > commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java > Sun Mar 24 02:02:11 2013 > > @@ -471,6 +471,15 @@ public class CSVFormat implements Serial > > } > > > > /** > > + * Creates a builder based on this format. > > + * > > + * @return a new builder > > + */ > > + public CSVFormatBuilder toBuilder() { > > + return new CSVFormatBuilder(this); > > + } > > + > > + /** > > * Builds CSVFormat objects. > > */ > > public static class CSVFormatBuilder { > > > > Modified: > commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatBuilderTest.java > > URL: > http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatBuilderTest.java?rev=1460254&r1=1460253&r2=1460254&view=diff > > > ============================================================================== > > --- > commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatBuilderTest.java > (original) > > +++ > commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatBuilderTest.java > Sun Mar 24 02:02:11 2013 > > @@ -59,6 +59,8 @@ public class CSVFormatBuilderTest { > > public void testCopiedFormatWithChanges() { > > final CSVFormat newFormat = > CSVFormat.newBuilder(RFC4180).withDelimiter('!').build(); > > assertTrue(newFormat.getDelimiter() != RFC4180.getDelimiter()); > > + final CSVFormat newFormat2 = > RFC4180.toBuilder().withDelimiter('!').build(); > > + assertTrue(newFormat2.getDelimiter() != RFC4180.getDelimiter()); > > } > > > > @Test > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- E-Mail: [email protected] | [email protected] JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0 Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
