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
This commit is contained in:
Benedikt Ritter 2014-07-21 16:28:07 +00:00
parent aa0762d538
commit 4695d73e3b
5 changed files with 18 additions and 18 deletions

View File

@ -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 * @return {@code true} if missing column names are allowed when parsing the header line, {@code false} to throw an
* {@link IllegalArgumentException}. * {@link IllegalArgumentException}.
*/ */
public boolean isAllowMissingColumnNames() { public boolean getAllowMissingColumnNames() {
return allowMissingColumnNames; 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 * @return {@code true} if empty lines between records are ignored, {@code false} if they are turned into empty
* records. * records.
*/ */
public boolean isIgnoringEmptyLines() { public boolean getIgnoreEmptyLines() {
return ignoreEmptyLines; 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 * @return {@code true} if spaces around values are ignored, {@code false} if they are treated as part of the
* value. * value.
*/ */
public boolean isIgnoringSurroundingSpaces() { public boolean getIgnoreSurroundingSpaces() {
return ignoreSurroundingSpaces; return ignoreSurroundingSpaces;
} }
@ -570,7 +570,7 @@ public final class CSVFormat implements Serializable {
* *
* @return whether to skip the header record. * @return whether to skip the header record.
*/ */
public boolean isSkippingHeaderRecord() { public boolean getSkipHeaderRecord() {
return skipHeaderRecord; return skipHeaderRecord;
} }
@ -690,10 +690,10 @@ public final class CSVFormat implements Serializable {
sb.append(' '); sb.append(' ');
sb.append("RecordSeparator=<").append(recordSeparator).append('>'); sb.append("RecordSeparator=<").append(recordSeparator).append('>');
} }
if (isIgnoringEmptyLines()) { if (getIgnoreEmptyLines()) {
sb.append(" EmptyLines:ignored"); sb.append(" EmptyLines:ignored");
} }
if (isIgnoringSurroundingSpaces()) { if (getIgnoreSurroundingSpaces()) {
sb.append(" SurroundingSpaces:ignored"); sb.append(" SurroundingSpaces:ignored");
} }
sb.append(" SkipHeaderRecord:").append(skipHeaderRecord); sb.append(" SkipHeaderRecord:").append(skipHeaderRecord);

View File

@ -352,7 +352,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
headerRecord = nextRecord.values(); headerRecord = nextRecord.values();
} }
} else { } else {
if (this.format.isSkippingHeaderRecord()) { if (this.format.getSkipHeaderRecord()) {
this.nextRecord(); this.nextRecord();
} }
headerRecord = formatHeader; headerRecord = formatHeader;
@ -364,7 +364,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
final String header = headerRecord[i]; final String header = headerRecord[i];
final boolean containsHeader = hdrMap.containsKey(header); final boolean containsHeader = hdrMap.containsKey(header);
final boolean emptyHeader = header == null || header.trim().isEmpty(); 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 + throw new IllegalArgumentException("The header contains a duplicate name: \"" + header +
"\" in " + Arrays.toString(headerRecord)); "\" in " + Arrays.toString(headerRecord));
} }

View File

@ -65,8 +65,8 @@ final class Lexer implements Closeable {
this.escape = mapNullToDisabled(format.getEscape()); this.escape = mapNullToDisabled(format.getEscape());
this.quoteChar = mapNullToDisabled(format.getQuoteChar()); this.quoteChar = mapNullToDisabled(format.getQuoteChar());
this.commentStart = mapNullToDisabled(format.getCommentStart()); this.commentStart = mapNullToDisabled(format.getCommentStart());
this.ignoreSurroundingSpaces = format.isIgnoringSurroundingSpaces(); this.ignoreSurroundingSpaces = format.getIgnoreSurroundingSpaces();
this.ignoreEmptyLines = format.isIgnoringEmptyLines(); this.ignoreEmptyLines = format.getIgnoreEmptyLines();
} }
/** /**

View File

@ -299,7 +299,7 @@ public class CSVFormatTest {
assertEquals(null, RFC4180.getCommentStart()); assertEquals(null, RFC4180.getCommentStart());
assertEquals(',', RFC4180.getDelimiter()); assertEquals(',', RFC4180.getDelimiter());
assertEquals(null, RFC4180.getEscape()); assertEquals(null, RFC4180.getEscape());
assertFalse(RFC4180.isIgnoringEmptyLines()); assertFalse(RFC4180.getIgnoreEmptyLines());
assertEquals(Character.valueOf('"'), RFC4180.getQuoteChar()); assertEquals(Character.valueOf('"'), RFC4180.getQuoteChar());
assertEquals(null, RFC4180.getQuotePolicy()); assertEquals(null, RFC4180.getQuotePolicy());
assertEquals("\r\n", RFC4180.getRecordSeparator()); assertEquals("\r\n", RFC4180.getRecordSeparator());
@ -324,8 +324,8 @@ public class CSVFormatTest {
assertEquals("comment start", CSVFormat.DEFAULT.getCommentStart(), format.getCommentStart()); assertEquals("comment start", CSVFormat.DEFAULT.getCommentStart(), format.getCommentStart());
assertEquals("record separator", CSVFormat.DEFAULT.getRecordSeparator(), format.getRecordSeparator()); assertEquals("record separator", CSVFormat.DEFAULT.getRecordSeparator(), format.getRecordSeparator());
assertEquals("escape", CSVFormat.DEFAULT.getEscape(), format.getEscape()); assertEquals("escape", CSVFormat.DEFAULT.getEscape(), format.getEscape());
assertEquals("trim", CSVFormat.DEFAULT.isIgnoringSurroundingSpaces(), format.isIgnoringSurroundingSpaces()); assertEquals("trim", CSVFormat.DEFAULT.getIgnoreSurroundingSpaces(), format.getIgnoreSurroundingSpaces());
assertEquals("empty lines", CSVFormat.DEFAULT.isIgnoringEmptyLines(), format.isIgnoringEmptyLines()); assertEquals("empty lines", CSVFormat.DEFAULT.getIgnoreEmptyLines(), format.getIgnoreEmptyLines());
} }
@Test @Test
@ -376,14 +376,14 @@ public class CSVFormatTest {
@Test @Test
public void testWithIgnoreEmptyLines() throws Exception { public void testWithIgnoreEmptyLines() throws Exception {
assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).isIgnoringEmptyLines()); assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).getIgnoreEmptyLines());
assertTrue(CSVFormat.DEFAULT.withIgnoreEmptyLines(true).isIgnoringEmptyLines()); assertTrue(CSVFormat.DEFAULT.withIgnoreEmptyLines(true).getIgnoreEmptyLines());
} }
@Test @Test
public void testWithIgnoreSurround() throws Exception { public void testWithIgnoreSurround() throws Exception {
assertFalse(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(false).isIgnoringSurroundingSpaces()); assertFalse(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(false).getIgnoreSurroundingSpaces());
assertTrue(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true).isIgnoringSurroundingSpaces()); assertTrue(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true).getIgnoreSurroundingSpaces());
} }
@Test @Test

View File

@ -159,7 +159,7 @@ public class LexerTest {
"\n"+ // 6c "\n"+ // 6c
"# Final comment\n"; // 7 "# Final comment\n"; // 7
final CSVFormat format = CSVFormat.DEFAULT.withCommentMarker('#').withIgnoreEmptyLines(false); 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); final Lexer parser = getLexer(code, format);