commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: svn commit: r1460254 - in /commons/proper/csv/trunk/src: main/java/org/apache/commons/csv/CSVFormat.java test/java/org/apache/commons/csv/CSVFormatBuilderTest.java
Date Sun, 24 Mar 2013 14:14:09 GMT
On Sun, Mar 24, 2013 at 8:30 AM, sebb <sebbaz@gmail.com> wrote:

> On 24 March 2013 02:02,  <ggregory@apache.org> 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: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message