- Add final modifier to method parameters.
- Add final modifier to local variables. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1495203 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4aa1f4d36c
commit
ab2e7eb504
|
@ -107,7 +107,7 @@ public class CSVFormat implements Serializable {
|
||||||
final Quote quotePolicy, final Character commentStart,
|
final Quote quotePolicy, final Character commentStart,
|
||||||
final Character escape, final boolean ignoreSurroundingSpaces,
|
final Character escape, final boolean ignoreSurroundingSpaces,
|
||||||
final boolean ignoreEmptyLines, final String recordSeparator,
|
final boolean ignoreEmptyLines, final String recordSeparator,
|
||||||
String nullToString, final String[] header) {
|
final String nullToString, final String[] header) {
|
||||||
if (isLineBreak(delimiter)) {
|
if (isLineBreak(delimiter)) {
|
||||||
throw new IllegalArgumentException("The delimiter cannot be a line break");
|
throw new IllegalArgumentException("The delimiter cannot be a line break");
|
||||||
}
|
}
|
||||||
|
@ -599,7 +599,7 @@ public class CSVFormat implements Serializable {
|
||||||
final Quote quotePolicy, final Character commentStart,
|
final Quote quotePolicy, final Character commentStart,
|
||||||
final Character escape, final boolean ignoreSurroundingSpaces,
|
final Character escape, final boolean ignoreSurroundingSpaces,
|
||||||
final boolean ignoreEmptyLines, final String recordSeparator,
|
final boolean ignoreEmptyLines, final String recordSeparator,
|
||||||
String nullToString, final String[] header) {
|
final String nullToString, final String[] header) {
|
||||||
if (isLineBreak(delimiter)) {
|
if (isLineBreak(delimiter)) {
|
||||||
throw new IllegalArgumentException("The delimiter cannot be a line break");
|
throw new IllegalArgumentException("The delimiter cannot be a line break");
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class CSVRecord implements Serializable, Iterable<String> {
|
||||||
final Integer index = mapping.get(name);
|
final Integer index = mapping.get(name);
|
||||||
try {
|
try {
|
||||||
return index != null ? values[index.intValue()] : null;
|
return index != null ? values[index.intValue()] : null;
|
||||||
} catch (ArrayIndexOutOfBoundsException e) {
|
} catch (final ArrayIndexOutOfBoundsException e) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
String.format(
|
String.format(
|
||||||
"Index for header '%s' is %d but CSVRecord only has %d values!",
|
"Index for header '%s' is %d but CSVRecord only has %d values!",
|
||||||
|
|
|
@ -95,8 +95,8 @@ public class CSVRecordTest {
|
||||||
@Test
|
@Test
|
||||||
public void testIterator() {
|
public void testIterator() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Iterator<String> itr = record.iterator(); itr.hasNext();) {
|
for (final Iterator<String> itr = record.iterator(); itr.hasNext();) {
|
||||||
String value = itr.next();
|
final String value = itr.next();
|
||||||
assertEquals(values[i], value);
|
assertEquals(values[i], value);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,14 +29,14 @@ final class TokenMatchers {
|
||||||
public static Matcher<Token> hasType(final Token.Type expectedType) {
|
public static Matcher<Token> hasType(final Token.Type expectedType) {
|
||||||
return new TypeSafeDiagnosingMatcher<Token>() {
|
return new TypeSafeDiagnosingMatcher<Token>() {
|
||||||
|
|
||||||
public void describeTo(Description description) {
|
public void describeTo(final Description description) {
|
||||||
description.appendText("token has type ");
|
description.appendText("token has type ");
|
||||||
description.appendValue(expectedType);
|
description.appendValue(expectedType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean matchesSafely(Token item,
|
protected boolean matchesSafely(final Token item,
|
||||||
Description mismatchDescription) {
|
final Description mismatchDescription) {
|
||||||
mismatchDescription.appendText("token type is ");
|
mismatchDescription.appendText("token type is ");
|
||||||
mismatchDescription.appendValue(item.type);
|
mismatchDescription.appendValue(item.type);
|
||||||
if (item.type == expectedType) {
|
if (item.type == expectedType) {
|
||||||
|
@ -50,14 +50,14 @@ final class TokenMatchers {
|
||||||
public static Matcher<Token> hasContent(final String expectedContent) {
|
public static Matcher<Token> hasContent(final String expectedContent) {
|
||||||
return new TypeSafeDiagnosingMatcher<Token>() {
|
return new TypeSafeDiagnosingMatcher<Token>() {
|
||||||
|
|
||||||
public void describeTo(Description description) {
|
public void describeTo(final Description description) {
|
||||||
description.appendText("token has content ");
|
description.appendText("token has content ");
|
||||||
description.appendValue(expectedContent);
|
description.appendValue(expectedContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean matchesSafely(Token item,
|
protected boolean matchesSafely(final Token item,
|
||||||
Description mismatchDescription) {
|
final Description mismatchDescription) {
|
||||||
mismatchDescription.appendText("token content is ");
|
mismatchDescription.appendText("token content is ");
|
||||||
mismatchDescription.appendValue(item.content.toString());
|
mismatchDescription.appendValue(item.content.toString());
|
||||||
if (expectedContent.equals(item.content.toString())) {
|
if (expectedContent.equals(item.content.toString())) {
|
||||||
|
@ -71,13 +71,13 @@ final class TokenMatchers {
|
||||||
public static Matcher<Token> isReady() {
|
public static Matcher<Token> isReady() {
|
||||||
return new TypeSafeDiagnosingMatcher<Token>() {
|
return new TypeSafeDiagnosingMatcher<Token>() {
|
||||||
|
|
||||||
public void describeTo(Description description) {
|
public void describeTo(final Description description) {
|
||||||
description.appendText("token is ready ");
|
description.appendText("token is ready ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean matchesSafely(Token item,
|
protected boolean matchesSafely(final Token item,
|
||||||
Description mismatchDescription) {
|
final Description mismatchDescription) {
|
||||||
mismatchDescription.appendText("token is not ready ");
|
mismatchDescription.appendText("token is not ready ");
|
||||||
return item.isReady;
|
return item.isReady;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue