From 4695d73e3b1974454d55a30be2b1c3a4bddbf3db Mon Sep 17 00:00:00 2001 From: Benedikt Ritter Date: Mon, 21 Jul 2014 16:28:07 +0000 Subject: [PATCH] Prefix everything that is a pure getter with "get" as proposed by Gary Gregory git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1612341 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/commons/csv/CSVFormat.java | 12 ++++++------ .../java/org/apache/commons/csv/CSVParser.java | 4 ++-- src/main/java/org/apache/commons/csv/Lexer.java | 4 ++-- .../java/org/apache/commons/csv/CSVFormatTest.java | 14 +++++++------- .../java/org/apache/commons/csv/LexerTest.java | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java index 0b818ccc..ea006fa5 100644 --- a/src/main/java/org/apache/commons/csv/CSVFormat.java +++ b/src/main/java/org/apache/commons/csv/CSVFormat.java @@ -497,7 +497,7 @@ public final class CSVFormat implements Serializable { * @return {@code true} if missing column names are allowed when parsing the header line, {@code false} to throw an * {@link IllegalArgumentException}. */ - public boolean isAllowMissingColumnNames() { + public boolean getAllowMissingColumnNames() { return allowMissingColumnNames; } @@ -507,7 +507,7 @@ public final class CSVFormat implements Serializable { * @return {@code true} if empty lines between records are ignored, {@code false} if they are turned into empty * records. */ - public boolean isIgnoringEmptyLines() { + public boolean getIgnoreEmptyLines() { return ignoreEmptyLines; } @@ -517,7 +517,7 @@ public final class CSVFormat implements Serializable { * @return {@code true} if spaces around values are ignored, {@code false} if they are treated as part of the * value. */ - public boolean isIgnoringSurroundingSpaces() { + public boolean getIgnoreSurroundingSpaces() { return ignoreSurroundingSpaces; } @@ -570,7 +570,7 @@ public final class CSVFormat implements Serializable { * * @return whether to skip the header record. */ - public boolean isSkippingHeaderRecord() { + public boolean getSkipHeaderRecord() { return skipHeaderRecord; } @@ -690,10 +690,10 @@ public final class CSVFormat implements Serializable { sb.append(' '); sb.append("RecordSeparator=<").append(recordSeparator).append('>'); } - if (isIgnoringEmptyLines()) { + if (getIgnoreEmptyLines()) { sb.append(" EmptyLines:ignored"); } - if (isIgnoringSurroundingSpaces()) { + if (getIgnoreSurroundingSpaces()) { sb.append(" SurroundingSpaces:ignored"); } sb.append(" SkipHeaderRecord:").append(skipHeaderRecord); diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java b/src/main/java/org/apache/commons/csv/CSVParser.java index cb19d3e0..31c24748 100644 --- a/src/main/java/org/apache/commons/csv/CSVParser.java +++ b/src/main/java/org/apache/commons/csv/CSVParser.java @@ -352,7 +352,7 @@ public final class CSVParser implements Iterable, Closeable { headerRecord = nextRecord.values(); } } else { - if (this.format.isSkippingHeaderRecord()) { + if (this.format.getSkipHeaderRecord()) { this.nextRecord(); } headerRecord = formatHeader; @@ -364,7 +364,7 @@ public final class CSVParser implements Iterable, Closeable { final String header = headerRecord[i]; final boolean containsHeader = hdrMap.containsKey(header); final boolean emptyHeader = header == null || header.trim().isEmpty(); - if (containsHeader && (!emptyHeader || (emptyHeader && !this.format.isAllowMissingColumnNames()))) { + if (containsHeader && (!emptyHeader || (emptyHeader && !this.format.getAllowMissingColumnNames()))) { throw new IllegalArgumentException("The header contains a duplicate name: \"" + header + "\" in " + Arrays.toString(headerRecord)); } diff --git a/src/main/java/org/apache/commons/csv/Lexer.java b/src/main/java/org/apache/commons/csv/Lexer.java index 21630d78..6a4075e0 100644 --- a/src/main/java/org/apache/commons/csv/Lexer.java +++ b/src/main/java/org/apache/commons/csv/Lexer.java @@ -65,8 +65,8 @@ final class Lexer implements Closeable { this.escape = mapNullToDisabled(format.getEscape()); this.quoteChar = mapNullToDisabled(format.getQuoteChar()); this.commentStart = mapNullToDisabled(format.getCommentStart()); - this.ignoreSurroundingSpaces = format.isIgnoringSurroundingSpaces(); - this.ignoreEmptyLines = format.isIgnoringEmptyLines(); + this.ignoreSurroundingSpaces = format.getIgnoreSurroundingSpaces(); + this.ignoreEmptyLines = format.getIgnoreEmptyLines(); } /** diff --git a/src/test/java/org/apache/commons/csv/CSVFormatTest.java b/src/test/java/org/apache/commons/csv/CSVFormatTest.java index 77d233e8..127c7fe8 100644 --- a/src/test/java/org/apache/commons/csv/CSVFormatTest.java +++ b/src/test/java/org/apache/commons/csv/CSVFormatTest.java @@ -299,7 +299,7 @@ public class CSVFormatTest { assertEquals(null, RFC4180.getCommentStart()); assertEquals(',', RFC4180.getDelimiter()); assertEquals(null, RFC4180.getEscape()); - assertFalse(RFC4180.isIgnoringEmptyLines()); + assertFalse(RFC4180.getIgnoreEmptyLines()); assertEquals(Character.valueOf('"'), RFC4180.getQuoteChar()); assertEquals(null, RFC4180.getQuotePolicy()); assertEquals("\r\n", RFC4180.getRecordSeparator()); @@ -324,8 +324,8 @@ public class CSVFormatTest { assertEquals("comment start", CSVFormat.DEFAULT.getCommentStart(), format.getCommentStart()); assertEquals("record separator", CSVFormat.DEFAULT.getRecordSeparator(), format.getRecordSeparator()); assertEquals("escape", CSVFormat.DEFAULT.getEscape(), format.getEscape()); - assertEquals("trim", CSVFormat.DEFAULT.isIgnoringSurroundingSpaces(), format.isIgnoringSurroundingSpaces()); - assertEquals("empty lines", CSVFormat.DEFAULT.isIgnoringEmptyLines(), format.isIgnoringEmptyLines()); + assertEquals("trim", CSVFormat.DEFAULT.getIgnoreSurroundingSpaces(), format.getIgnoreSurroundingSpaces()); + assertEquals("empty lines", CSVFormat.DEFAULT.getIgnoreEmptyLines(), format.getIgnoreEmptyLines()); } @Test @@ -376,14 +376,14 @@ public class CSVFormatTest { @Test public void testWithIgnoreEmptyLines() throws Exception { - assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).isIgnoringEmptyLines()); - assertTrue(CSVFormat.DEFAULT.withIgnoreEmptyLines(true).isIgnoringEmptyLines()); + assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).getIgnoreEmptyLines()); + assertTrue(CSVFormat.DEFAULT.withIgnoreEmptyLines(true).getIgnoreEmptyLines()); } @Test public void testWithIgnoreSurround() throws Exception { - assertFalse(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(false).isIgnoringSurroundingSpaces()); - assertTrue(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true).isIgnoringSurroundingSpaces()); + assertFalse(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(false).getIgnoreSurroundingSpaces()); + assertTrue(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true).getIgnoreSurroundingSpaces()); } @Test diff --git a/src/test/java/org/apache/commons/csv/LexerTest.java b/src/test/java/org/apache/commons/csv/LexerTest.java index 6de10ee8..3b50c0b5 100644 --- a/src/test/java/org/apache/commons/csv/LexerTest.java +++ b/src/test/java/org/apache/commons/csv/LexerTest.java @@ -159,7 +159,7 @@ public class LexerTest { "\n"+ // 6c "# Final comment\n"; // 7 final CSVFormat format = CSVFormat.DEFAULT.withCommentMarker('#').withIgnoreEmptyLines(false); - assertFalse("Should not ignore empty lines", format.isIgnoringEmptyLines()); + assertFalse("Should not ignore empty lines", format.getIgnoreEmptyLines()); final Lexer parser = getLexer(code, format);