Author: britter Date: Wed Jul 31 17:43:14 2013 New Revision: 1508966 URL: http://svn.apache.org/r1508966 Log: Remove copy method. It is not needed since every withXxx() method returns a copy
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/CSVFormatTest.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=1508966&r1=1508965&r2=1508966&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 Wed Jul 31 17:43:14 2013 @@ -172,17 +172,6 @@ public class CSVFormat implements Serial } /** - * Creates a CSVFormatBuilder, using the values of the given CSVFormat. - * - * @param format - * The format to use values from - * @return a new CSVFormat - */ - public static CSVFormat copy(final CSVFormat format) { - return new CSVFormat(format); - } - - /** * Creates a customized CSV format. * * @param delimiter @@ -230,12 +219,6 @@ public class CSVFormat implements Serial this.skipHeaderRecord = skipHeaderRecord; } - CSVFormat(final CSVFormat format) { - this(format.getDelimiter(), format.getQuoteChar(), format.getQuotePolicy(), format.getCommentStart(), - format.getEscape(), format.getIgnoreSurroundingSpaces(), format.getIgnoreEmptyLines(), - format.getRecordSeparator(), format.getNullString(), format.getHeader(), format.getSkipHeaderRecord()); - } - @Override public boolean equals(final Object obj) { if (this == obj) { Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java?rev=1508966&r1=1508965&r2=1508966&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java Wed Jul 31 17:43:14 2013 @@ -65,7 +65,7 @@ public class CSVFormatTest { @Test public void testEquals() { final CSVFormat right = CSVFormat.DEFAULT; - final CSVFormat left = CSVFormat.copy(right); + final CSVFormat left = copy(right); assertFalse(right.equals(null)); assertFalse(right.equals("A String Instance")); @@ -84,7 +84,7 @@ public class CSVFormatTest { .withQuoteChar('"') .withCommentStart('#') .withQuotePolicy(Quote.ALL); - final CSVFormat left = CSVFormat.copy(right) + final CSVFormat left = right .withCommentStart('!'); assertNotEquals(right, left); @@ -105,7 +105,7 @@ public class CSVFormatTest { .withCommentStart('#') .withEscape('+') .withQuotePolicy(Quote.ALL); - final CSVFormat left = CSVFormat.copy(right) + final CSVFormat left = right .withEscape('!'); assertNotEquals(right, left); @@ -122,7 +122,7 @@ public class CSVFormatTest { .withIgnoreSurroundingSpaces(true) .withQuoteChar('"') .withQuotePolicy(Quote.ALL); - final CSVFormat left = CSVFormat.copy(right) + final CSVFormat left = right .withHeader("Three", "Two", "One"); assertNotEquals(right, left); @@ -137,7 +137,7 @@ public class CSVFormatTest { .withIgnoreSurroundingSpaces(true) .withQuoteChar('"') .withQuotePolicy(Quote.ALL); - final CSVFormat left = CSVFormat.copy(right) + final CSVFormat left = right .withIgnoreEmptyLines(false); assertNotEquals(right, left); @@ -151,7 +151,7 @@ public class CSVFormatTest { .withIgnoreSurroundingSpaces(true) .withQuoteChar('"') .withQuotePolicy(Quote.ALL); - final CSVFormat left = CSVFormat.copy(right) + final CSVFormat left = right .withIgnoreSurroundingSpaces(false); assertNotEquals(right, left); @@ -160,7 +160,7 @@ public class CSVFormatTest { @Test public void testEqualsQuoteChar() { final CSVFormat right = CSVFormat.newFormat('\'').withQuoteChar('"'); - final CSVFormat left = CSVFormat.copy(right).withQuoteChar('!'); + final CSVFormat left = right.withQuoteChar('!'); assertNotEquals(right, left); } @@ -170,7 +170,7 @@ public class CSVFormatTest { final CSVFormat right = CSVFormat.newFormat('\'') .withQuoteChar('"') .withQuotePolicy(Quote.ALL); - final CSVFormat left = CSVFormat.copy(right) + final CSVFormat left = right .withQuotePolicy(Quote.MINIMAL); assertNotEquals(right, left); @@ -186,7 +186,7 @@ public class CSVFormatTest { .withIgnoreSurroundingSpaces(true) .withQuoteChar('"') .withQuotePolicy(Quote.ALL); - final CSVFormat left = CSVFormat.copy(right) + final CSVFormat left = right .withRecordSeparator('!'); assertNotEquals(right, left); @@ -366,4 +366,8 @@ public class CSVFormatTest { CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withRecordSeparator('!'); assertEquals("!", formatWithRecordSeparator.getRecordSeparator()); } + + private static CSVFormat copy(final CSVFormat format) { + return format.withDelimiter(format.getDelimiter()); + } }