On 24 March 2013 02:02,  <ggreg...@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

> 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-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to