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
* {@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);

View File

@ -352,7 +352,7 @@ public final class CSVParser implements Iterable<CSVRecord>, 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<CSVRecord>, 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));
}

View File

@ -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();
}
/**

View File

@ -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

View File

@ -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);