On Sun, Mar 24, 2013 at 9:06 AM, Benedikt Ritter <brit...@apache.org> wrote:

> 2013/3/24 <ggreg...@apache.org>
>
> > 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();
> >
>
> Good idea Gary! I like this.
>

Thank you  BenediKt ;)

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
> >
> >
> >
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter
>



-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
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

Reply via email to