Add final modifier to method parameters.
This commit is contained in:
parent
607e3447c9
commit
aadb9a31ed
|
@ -1852,7 +1852,7 @@ public class ArrayUtils {
|
|||
* @param offset2 the index of the second element to swap
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void swap(final Object[] array, int offset1, int offset2) {
|
||||
public static void swap(final Object[] array, final int offset1, final int offset2) {
|
||||
if (array == null || array.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1881,7 +1881,7 @@ public class ArrayUtils {
|
|||
* @param offset2 the index of the second element to swap
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void swap(final long[] array, int offset1, int offset2) {
|
||||
public static void swap(final long[] array, final int offset1, final int offset2) {
|
||||
if (array == null || array.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1909,7 +1909,7 @@ public class ArrayUtils {
|
|||
* @param offset2 the index of the second element to swap
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void swap(final int[] array, int offset1, int offset2) {
|
||||
public static void swap(final int[] array, final int offset1, final int offset2) {
|
||||
if (array == null || array.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1937,7 +1937,7 @@ public class ArrayUtils {
|
|||
* @param offset2 the index of the second element to swap
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void swap(final short[] array, int offset1, int offset2) {
|
||||
public static void swap(final short[] array, final int offset1, final int offset2) {
|
||||
if (array == null || array.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1965,7 +1965,7 @@ public class ArrayUtils {
|
|||
* @param offset2 the index of the second element to swap
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void swap(final char[] array, int offset1, int offset2) {
|
||||
public static void swap(final char[] array, final int offset1, final int offset2) {
|
||||
if (array == null || array.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1993,7 +1993,7 @@ public class ArrayUtils {
|
|||
* @param offset2 the index of the second element to swap
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void swap(final byte[] array, int offset1, int offset2) {
|
||||
public static void swap(final byte[] array, final int offset1, final int offset2) {
|
||||
if (array == null || array.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -2021,7 +2021,7 @@ public class ArrayUtils {
|
|||
* @param offset2 the index of the second element to swap
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void swap(final double[] array, int offset1, int offset2) {
|
||||
public static void swap(final double[] array, final int offset1, final int offset2) {
|
||||
if (array == null || array.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -2049,7 +2049,7 @@ public class ArrayUtils {
|
|||
* @param offset2 the index of the second element to swap
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void swap(final float[] array, int offset1, int offset2) {
|
||||
public static void swap(final float[] array, final int offset1, final int offset2) {
|
||||
if (array == null || array.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -2077,7 +2077,7 @@ public class ArrayUtils {
|
|||
* @param offset2 the index of the second element to swap
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void swap(final boolean[] array, int offset1, int offset2) {
|
||||
public static void swap(final boolean[] array, final int offset1, final int offset2) {
|
||||
if (array == null || array.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -2480,7 +2480,7 @@ public class ArrayUtils {
|
|||
* rotate, than the effective offset is modulo the number of elements to rotate.
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void shift(final Object[] array, int offset) {
|
||||
public static void shift(final Object[] array, final int offset) {
|
||||
if (array == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -2499,7 +2499,7 @@ public class ArrayUtils {
|
|||
* rotate, than the effective offset is modulo the number of elements to rotate.
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void shift(final long[] array, int offset) {
|
||||
public static void shift(final long[] array, final int offset) {
|
||||
if (array == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -2518,7 +2518,7 @@ public class ArrayUtils {
|
|||
* rotate, than the effective offset is modulo the number of elements to rotate.
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void shift(final int[] array, int offset) {
|
||||
public static void shift(final int[] array, final int offset) {
|
||||
if (array == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -2537,7 +2537,7 @@ public class ArrayUtils {
|
|||
* rotate, than the effective offset is modulo the number of elements to rotate.
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void shift(final short[] array, int offset) {
|
||||
public static void shift(final short[] array, final int offset) {
|
||||
if (array == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -2556,7 +2556,7 @@ public class ArrayUtils {
|
|||
* rotate, than the effective offset is modulo the number of elements to rotate.
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void shift(final char[] array, int offset) {
|
||||
public static void shift(final char[] array, final int offset) {
|
||||
if (array == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -2575,7 +2575,7 @@ public class ArrayUtils {
|
|||
* rotate, than the effective offset is modulo the number of elements to rotate.
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void shift(final byte[] array, int offset) {
|
||||
public static void shift(final byte[] array, final int offset) {
|
||||
if (array == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -2594,7 +2594,7 @@ public class ArrayUtils {
|
|||
* rotate, than the effective offset is modulo the number of elements to rotate.
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void shift(final double[] array, int offset) {
|
||||
public static void shift(final double[] array, final int offset) {
|
||||
if (array == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -2613,7 +2613,7 @@ public class ArrayUtils {
|
|||
* rotate, than the effective offset is modulo the number of elements to rotate.
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void shift(final float[] array, int offset) {
|
||||
public static void shift(final float[] array, final int offset) {
|
||||
if (array == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -2632,7 +2632,7 @@ public class ArrayUtils {
|
|||
* rotate, than the effective offset is modulo the number of elements to rotate.
|
||||
* @since 3.5
|
||||
*/
|
||||
public static void shift(final boolean[] array, int offset) {
|
||||
public static void shift(final boolean[] array, final int offset) {
|
||||
if (array == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -7440,7 +7440,7 @@ public class ArrayUtils {
|
|||
public static <T extends Comparable<? super T>> boolean isSorted(final T[] array) {
|
||||
return isSorted(array, new Comparator<T>() {
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
public int compare(final T o1, final T o2) {
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
});
|
||||
|
@ -7485,7 +7485,7 @@ public class ArrayUtils {
|
|||
* @return whether the array is sorted according to natural ordering
|
||||
* @since 3.4
|
||||
*/
|
||||
public static boolean isSorted(int[] array) {
|
||||
public static boolean isSorted(final int[] array) {
|
||||
if (array == null || array.length < 2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -7510,7 +7510,7 @@ public class ArrayUtils {
|
|||
* @return whether the array is sorted according to natural ordering
|
||||
* @since 3.4
|
||||
*/
|
||||
public static boolean isSorted(long[] array) {
|
||||
public static boolean isSorted(final long[] array) {
|
||||
if (array == null || array.length < 2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -7535,7 +7535,7 @@ public class ArrayUtils {
|
|||
* @return whether the array is sorted according to natural ordering
|
||||
* @since 3.4
|
||||
*/
|
||||
public static boolean isSorted(short[] array) {
|
||||
public static boolean isSorted(final short[] array) {
|
||||
if (array == null || array.length < 2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -7610,7 +7610,7 @@ public class ArrayUtils {
|
|||
* @return whether the array is sorted according to natural ordering
|
||||
* @since 3.4
|
||||
*/
|
||||
public static boolean isSorted(byte[] array) {
|
||||
public static boolean isSorted(final byte[] array) {
|
||||
if (array == null || array.length < 2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -7635,7 +7635,7 @@ public class ArrayUtils {
|
|||
* @return whether the array is sorted according to natural ordering
|
||||
* @since 3.4
|
||||
*/
|
||||
public static boolean isSorted(char[] array) {
|
||||
public static boolean isSorted(final char[] array) {
|
||||
if (array == null || array.length < 2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -7661,7 +7661,7 @@ public class ArrayUtils {
|
|||
* @return whether the array is sorted according to natural ordering
|
||||
* @since 3.4
|
||||
*/
|
||||
public static boolean isSorted(boolean[] array) {
|
||||
public static boolean isSorted(final boolean[] array) {
|
||||
if (array == null || array.length < 2) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1091,7 +1091,7 @@ public class BooleanUtils {
|
|||
* a value greater than {@code 0} if {@code x && !y}
|
||||
* @since 3.4
|
||||
*/
|
||||
public static int compare(boolean x, boolean y) {
|
||||
public static int compare(final boolean x, final boolean y) {
|
||||
if (x == y) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -546,7 +546,7 @@ public class CharUtils {
|
|||
* a value greater than {@code 0} if {@code x > y}
|
||||
* @since 3.4
|
||||
*/
|
||||
public static int compare(char x, char y) {
|
||||
public static int compare(final char x, final char y) {
|
||||
return x-y;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -341,7 +341,7 @@ public class ClassUtils {
|
|||
* @see #getAbbreviatedName(String, int)
|
||||
* @since 3.4
|
||||
*/
|
||||
public static String getAbbreviatedName(final Class<?> cls, int len) {
|
||||
public static String getAbbreviatedName(final Class<?> cls, final int len) {
|
||||
if (cls == null) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ public class ClassUtils {
|
|||
* @throws IllegalArgumentException if len <= 0
|
||||
* @since 3.4
|
||||
*/
|
||||
public static String getAbbreviatedName(String className, int len) {
|
||||
public static String getAbbreviatedName(final String className, final int len) {
|
||||
if (len <= 0) {
|
||||
throw new IllegalArgumentException("len must be > 0");
|
||||
}
|
||||
|
|
|
@ -551,7 +551,7 @@ public class StringUtils {
|
|||
* @return truncated String, {@code null} if null String input
|
||||
* @since 3.5
|
||||
*/
|
||||
public static String truncate(final String str, int maxWidth) {
|
||||
public static String truncate(final String str, final int maxWidth) {
|
||||
return truncate(str, 0, maxWidth);
|
||||
}
|
||||
|
||||
|
@ -614,7 +614,7 @@ public class StringUtils {
|
|||
* @return truncated String, {@code null} if null String input
|
||||
* @since 3.5
|
||||
*/
|
||||
public static String truncate(final String str, int offset, int maxWidth) {
|
||||
public static String truncate(final String str, final int offset, final int maxWidth) {
|
||||
if (offset < 0) {
|
||||
throw new IllegalArgumentException("offset cannot be negative");
|
||||
}
|
||||
|
@ -933,7 +933,7 @@ public class StringUtils {
|
|||
return pattern.matcher(decomposed).replaceAll(StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
private static void convertRemainingAccentCharacters(StringBuilder decomposed) {
|
||||
private static void convertRemainingAccentCharacters(final StringBuilder decomposed) {
|
||||
for (int i = 0; i < decomposed.length(); i++) {
|
||||
if (decomposed.charAt(i) == '\u0141') {
|
||||
decomposed.deleteCharAt(i);
|
||||
|
@ -2147,7 +2147,7 @@ public class StringUtils {
|
|||
* @return {@code true} if any of the search CharSequences are found, {@code false} otherwise
|
||||
* @since 3.4
|
||||
*/
|
||||
public static boolean containsAny(CharSequence cs, CharSequence... searchCharSequences) {
|
||||
public static boolean containsAny(final CharSequence cs, final CharSequence... searchCharSequences) {
|
||||
if (isEmpty(cs) || ArrayUtils.isEmpty(searchCharSequences)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -4912,7 +4912,7 @@ public class StringUtils {
|
|||
* null String input
|
||||
* @since 3.5
|
||||
*/
|
||||
public static String removeIgnoreCase(String str, String remove) {
|
||||
public static String removeIgnoreCase(final String str, final String remove) {
|
||||
if (isEmpty(str) || isEmpty(remove)) {
|
||||
return str;
|
||||
}
|
||||
|
@ -5099,7 +5099,7 @@ public class StringUtils {
|
|||
* {@code null} if null String input
|
||||
* @since 3.5
|
||||
*/
|
||||
public static String replaceOnceIgnoreCase(String text, String searchString, String replacement) {
|
||||
public static String replaceOnceIgnoreCase(final String text, final String searchString, final String replacement) {
|
||||
return replaceIgnoreCase(text, searchString, replacement, 1);
|
||||
}
|
||||
|
||||
|
@ -5342,7 +5342,7 @@ public class StringUtils {
|
|||
* {@code null} if null String input
|
||||
* @since 3.5
|
||||
*/
|
||||
public static String replaceIgnoreCase(String text, String searchString, String replacement) {
|
||||
public static String replaceIgnoreCase(final String text, final String searchString, final String replacement) {
|
||||
return replaceIgnoreCase(text, searchString, replacement, -1);
|
||||
}
|
||||
|
||||
|
@ -5374,7 +5374,7 @@ public class StringUtils {
|
|||
* @return the text with any replacements processed,
|
||||
* {@code null} if null String input
|
||||
*/
|
||||
public static String replace(final String text, final String searchString, final String replacement, int max) {
|
||||
public static String replace(final String text, final String searchString, final String replacement, final int max) {
|
||||
return replace(text, searchString, replacement, max, false);
|
||||
}
|
||||
|
||||
|
@ -5409,7 +5409,7 @@ public class StringUtils {
|
|||
* @return the text with any replacements processed,
|
||||
* {@code null} if null String input
|
||||
*/
|
||||
private static String replace(String text, String searchString, String replacement, int max, boolean ignoreCase) {
|
||||
private static String replace(final String text, String searchString, final String replacement, int max, final boolean ignoreCase) {
|
||||
if (isEmpty(text) || isEmpty(searchString) || replacement == null || max == 0) {
|
||||
return text;
|
||||
}
|
||||
|
@ -5469,7 +5469,7 @@ public class StringUtils {
|
|||
* {@code null} if null String input
|
||||
* @since 3.5
|
||||
*/
|
||||
public static String replaceIgnoreCase(String text, String searchString, String replacement, int max) {
|
||||
public static String replaceIgnoreCase(final String text, final String searchString, final String replacement, final int max) {
|
||||
return replace(text, searchString, replacement, max, true);
|
||||
}
|
||||
|
||||
|
@ -7275,7 +7275,7 @@ public class StringUtils {
|
|||
* or {@code null} if null String input
|
||||
* @since 3.5
|
||||
*/
|
||||
public static String rotate(String str, int shift) {
|
||||
public static String rotate(final String str, final int shift) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle {
|
|||
* @param spaces how far to indent
|
||||
* @return a StringBuilder with {spaces} leading space characters.
|
||||
*/
|
||||
private StringBuilder spacer(int spaces) {
|
||||
private StringBuilder spacer(final int spaces) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < spaces; i++) {
|
||||
sb.append(" ");
|
||||
|
@ -113,7 +113,7 @@ public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void appendDetail(StringBuffer buffer, String fieldName, Object value) {
|
||||
public void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) {
|
||||
if (!ClassUtils.isPrimitiveWrapper(value.getClass()) && !String.class.equals(value.getClass())
|
||||
&& accept(value.getClass())) {
|
||||
spaces += indent;
|
||||
|
|
|
@ -2403,8 +2403,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void append(StringBuffer buffer, String fieldName,
|
||||
Object[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName,
|
||||
final Object[] array, final Boolean fullDetail) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -2419,8 +2419,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void append(StringBuffer buffer, String fieldName, long[] array,
|
||||
Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final long[] array,
|
||||
final Boolean fullDetail) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -2435,8 +2435,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void append(StringBuffer buffer, String fieldName, int[] array,
|
||||
Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final int[] array,
|
||||
final Boolean fullDetail) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -2451,8 +2451,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void append(StringBuffer buffer, String fieldName,
|
||||
short[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName,
|
||||
final short[] array, final Boolean fullDetail) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -2467,8 +2467,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void append(StringBuffer buffer, String fieldName, byte[] array,
|
||||
Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final byte[] array,
|
||||
final Boolean fullDetail) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -2483,8 +2483,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void append(StringBuffer buffer, String fieldName, char[] array,
|
||||
Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final char[] array,
|
||||
final Boolean fullDetail) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -2499,8 +2499,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void append(StringBuffer buffer, String fieldName,
|
||||
double[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName,
|
||||
final double[] array, final Boolean fullDetail) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -2515,8 +2515,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void append(StringBuffer buffer, String fieldName,
|
||||
float[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName,
|
||||
final float[] array, final Boolean fullDetail) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -2531,8 +2531,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void append(StringBuffer buffer, String fieldName,
|
||||
boolean[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName,
|
||||
final boolean[] array, final Boolean fullDetail) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -2547,8 +2547,8 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void append(StringBuffer buffer, String fieldName, Object value,
|
||||
Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final Object value,
|
||||
final Boolean fullDetail) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
@ -2563,12 +2563,12 @@ public abstract class ToStringStyle implements Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, char value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final char value) {
|
||||
appendValueAsString(buffer, String.valueOf(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, Object value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) {
|
||||
|
||||
if (value == null) {
|
||||
appendNullText(buffer, fieldName);
|
||||
|
@ -2594,12 +2594,12 @@ public abstract class ToStringStyle implements Serializable {
|
|||
appendDetail(buffer, fieldName, valueAsString);
|
||||
}
|
||||
|
||||
private boolean isJsonArray(String valueAsString) {
|
||||
private boolean isJsonArray(final String valueAsString) {
|
||||
return valueAsString.startsWith(getArrayStart())
|
||||
&& valueAsString.startsWith(getArrayEnd());
|
||||
}
|
||||
|
||||
private boolean isJsonObject(String valueAsString) {
|
||||
private boolean isJsonObject(final String valueAsString) {
|
||||
return valueAsString.startsWith(getContentStart())
|
||||
&& valueAsString.endsWith(getContentEnd());
|
||||
}
|
||||
|
@ -2610,12 +2610,12 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param buffer the StringBuffer to append the value to.
|
||||
* @param value the value to append.
|
||||
*/
|
||||
private void appendValueAsString(StringBuffer buffer, String value) {
|
||||
private void appendValueAsString(final StringBuffer buffer, final String value) {
|
||||
buffer.append("\"" + value + "\"");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendFieldStart(StringBuffer buffer, String fieldName) {
|
||||
protected void appendFieldStart(final StringBuffer buffer, final String fieldName) {
|
||||
|
||||
if (fieldName == null) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
|
|
@ -90,7 +90,7 @@ public abstract class AbstractCircuitBreaker<T> implements CircuitBreaker<T> {
|
|||
* @param state the state to be converted
|
||||
* @return the boolean open flag
|
||||
*/
|
||||
protected static boolean isOpen(State state) {
|
||||
protected static boolean isOpen(final State state) {
|
||||
return state == State.OPEN;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public abstract class AbstractCircuitBreaker<T> implements CircuitBreaker<T> {
|
|||
*
|
||||
* @param newState the new state to be set
|
||||
*/
|
||||
protected void changeState(State newState) {
|
||||
protected void changeState(final State newState) {
|
||||
if (state.compareAndSet(newState.oppositeState(), newState)) {
|
||||
changeSupport.firePropertyChange(PROPERTY_NAME, !isOpen(newState), isOpen(newState));
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public abstract class AbstractCircuitBreaker<T> implements CircuitBreaker<T> {
|
|||
*
|
||||
* @param listener the listener to be added
|
||||
*/
|
||||
public void addChangeListener(PropertyChangeListener listener) {
|
||||
public void addChangeListener(final PropertyChangeListener listener) {
|
||||
changeSupport.addPropertyChangeListener(listener);
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public abstract class AbstractCircuitBreaker<T> implements CircuitBreaker<T> {
|
|||
*
|
||||
* @param listener the listener to be removed
|
||||
*/
|
||||
public void removeChangeListener(PropertyChangeListener listener) {
|
||||
public void removeChangeListener(final PropertyChangeListener listener) {
|
||||
changeSupport.removePropertyChangeListener(listener);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class CircuitBreakingException extends RuntimeException {
|
|||
* @param message the error message
|
||||
* @param cause the cause of this exception
|
||||
*/
|
||||
public CircuitBreakingException(String message, Throwable cause) {
|
||||
public CircuitBreakingException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class CircuitBreakingException extends RuntimeException {
|
|||
*
|
||||
* @param message the error message
|
||||
*/
|
||||
public CircuitBreakingException(String message) {
|
||||
public CircuitBreakingException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class CircuitBreakingException extends RuntimeException {
|
|||
*
|
||||
* @param cause the cause of this exception
|
||||
*/
|
||||
public CircuitBreakingException(Throwable cause) {
|
||||
public CircuitBreakingException(final Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -171,9 +171,9 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* @param closingInterval the interval for closing the circuit breaker
|
||||
* @param closingUnit the {@code TimeUnit} defining the closing interval
|
||||
*/
|
||||
public EventCountCircuitBreaker(int openingThreshold, long openingInterval,
|
||||
TimeUnit openingUnit, int closingThreshold, long closingInterval,
|
||||
TimeUnit closingUnit) {
|
||||
public EventCountCircuitBreaker(final int openingThreshold, final long openingInterval,
|
||||
final TimeUnit openingUnit, final int closingThreshold, final long closingInterval,
|
||||
final TimeUnit closingUnit) {
|
||||
super();
|
||||
checkIntervalData = new AtomicReference<>(new CheckIntervalData(0, 0));
|
||||
this.openingThreshold = openingThreshold;
|
||||
|
@ -195,8 +195,8 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* number of events received in the time span determined by the check interval goes
|
||||
* below this threshold, the circuit breaker is closed again
|
||||
*/
|
||||
public EventCountCircuitBreaker(int openingThreshold, long checkInterval, TimeUnit checkUnit,
|
||||
int closingThreshold) {
|
||||
public EventCountCircuitBreaker(final int openingThreshold, final long checkInterval, final TimeUnit checkUnit,
|
||||
final int closingThreshold) {
|
||||
this(openingThreshold, checkInterval, checkUnit, closingThreshold, checkInterval,
|
||||
checkUnit);
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* @param checkInterval the check interval for opening or closing the circuit breaker
|
||||
* @param checkUnit the {@code TimeUnit} defining the check interval
|
||||
*/
|
||||
public EventCountCircuitBreaker(int threshold, long checkInterval, TimeUnit checkUnit) {
|
||||
public EventCountCircuitBreaker(final int threshold, final long checkInterval, final TimeUnit checkUnit) {
|
||||
this(threshold, checkInterval, checkUnit, threshold);
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean incrementAndCheckState(Integer increment)
|
||||
public boolean incrementAndCheckState(final Integer increment)
|
||||
throws CircuitBreakingException {
|
||||
return performStateCheck(1);
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* @param increment the increment for the internal counter
|
||||
* @return a flag whether the circuit breaker is now closed
|
||||
*/
|
||||
private boolean performStateCheck(int increment) {
|
||||
private boolean performStateCheck(final int increment) {
|
||||
CheckIntervalData currentData;
|
||||
CheckIntervalData nextData;
|
||||
State currentState;
|
||||
|
@ -348,8 +348,8 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* @param nextData the replacing check data object
|
||||
* @return a flag whether the update was successful
|
||||
*/
|
||||
private boolean updateCheckIntervalData(CheckIntervalData currentData,
|
||||
CheckIntervalData nextData) {
|
||||
private boolean updateCheckIntervalData(final CheckIntervalData currentData,
|
||||
final CheckIntervalData nextData) {
|
||||
return currentData == nextData
|
||||
|| checkIntervalData.compareAndSet(currentData, nextData);
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
*
|
||||
* @param newState the new state to be set
|
||||
*/
|
||||
private void changeStateAndStartNewCheckInterval(State newState) {
|
||||
private void changeStateAndStartNewCheckInterval(final State newState) {
|
||||
changeState(newState);
|
||||
checkIntervalData.set(new CheckIntervalData(0, now()));
|
||||
}
|
||||
|
@ -376,8 +376,8 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* @param time the current time
|
||||
* @return the updated {@code CheckIntervalData} object
|
||||
*/
|
||||
private CheckIntervalData nextCheckIntervalData(int increment,
|
||||
CheckIntervalData currentData, State currentState, long time) {
|
||||
private CheckIntervalData nextCheckIntervalData(final int increment,
|
||||
final CheckIntervalData currentData, final State currentState, final long time) {
|
||||
CheckIntervalData nextData;
|
||||
if (stateStrategy(currentState).isCheckIntervalFinished(this, currentData, time)) {
|
||||
nextData = new CheckIntervalData(increment, time);
|
||||
|
@ -404,7 +404,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* @return the corresponding {@code StateStrategy}
|
||||
* @throws CircuitBreakingException if the strategy cannot be resolved
|
||||
*/
|
||||
private static StateStrategy stateStrategy(State state) {
|
||||
private static StateStrategy stateStrategy(final State state) {
|
||||
StateStrategy strategy = STRATEGY_MAP.get(state);
|
||||
return strategy;
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* @param count the current count value
|
||||
* @param intervalStart the start time of the check interval
|
||||
*/
|
||||
public CheckIntervalData(int count, long intervalStart) {
|
||||
public CheckIntervalData(final int count, final long intervalStart) {
|
||||
eventCount = count;
|
||||
checkIntervalStart = intervalStart;
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* @param delta the delta
|
||||
* @return the updated instance
|
||||
*/
|
||||
public CheckIntervalData increment(int delta) {
|
||||
public CheckIntervalData increment(final int delta) {
|
||||
return (delta != 0) ? new CheckIntervalData(getEventCount() + delta,
|
||||
getCheckIntervalStart()) : this;
|
||||
}
|
||||
|
@ -490,8 +490,8 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* @param now the current time
|
||||
* @return a flag whether the end of the current check interval is reached
|
||||
*/
|
||||
public boolean isCheckIntervalFinished(EventCountCircuitBreaker breaker,
|
||||
CheckIntervalData currentData, long now) {
|
||||
public boolean isCheckIntervalFinished(final EventCountCircuitBreaker breaker,
|
||||
final CheckIntervalData currentData, final long now) {
|
||||
return now - currentData.getCheckIntervalStart() > fetchCheckInterval(breaker);
|
||||
}
|
||||
|
||||
|
@ -527,8 +527,8 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isStateTransition(EventCountCircuitBreaker breaker,
|
||||
CheckIntervalData currentData, CheckIntervalData nextData) {
|
||||
public boolean isStateTransition(final EventCountCircuitBreaker breaker,
|
||||
final CheckIntervalData currentData, final CheckIntervalData nextData) {
|
||||
return nextData.getEventCount() > breaker.getOpeningThreshold();
|
||||
}
|
||||
|
||||
|
@ -536,7 +536,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected long fetchCheckInterval(EventCountCircuitBreaker breaker) {
|
||||
protected long fetchCheckInterval(final EventCountCircuitBreaker breaker) {
|
||||
return breaker.getOpeningInterval();
|
||||
}
|
||||
}
|
||||
|
@ -549,8 +549,8 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isStateTransition(EventCountCircuitBreaker breaker,
|
||||
CheckIntervalData currentData, CheckIntervalData nextData) {
|
||||
public boolean isStateTransition(final EventCountCircuitBreaker breaker,
|
||||
final CheckIntervalData currentData, final CheckIntervalData nextData) {
|
||||
return nextData.getCheckIntervalStart() != currentData
|
||||
.getCheckIntervalStart()
|
||||
&& currentData.getEventCount() < breaker.getClosingThreshold();
|
||||
|
@ -560,7 +560,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer> {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected long fetchCheckInterval(EventCountCircuitBreaker breaker) {
|
||||
protected long fetchCheckInterval(final EventCountCircuitBreaker breaker) {
|
||||
return breaker.getClosingInterval();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ThresholdCircuitBreaker extends AbstractCircuitBreaker<Long> {
|
|||
*
|
||||
* @param threshold the threshold.
|
||||
*/
|
||||
public ThresholdCircuitBreaker(long threshold) {
|
||||
public ThresholdCircuitBreaker(final long threshold) {
|
||||
super();
|
||||
this.used = new AtomicLong(INITIAL_COUNT);
|
||||
this.threshold = threshold;
|
||||
|
@ -112,7 +112,7 @@ public class ThresholdCircuitBreaker extends AbstractCircuitBreaker<Long> {
|
|||
* <p>If the threshold is zero, the circuit breaker will be in a permanent <em>open</em> state.</p>
|
||||
*/
|
||||
@Override
|
||||
public boolean incrementAndCheckState(Long increment) throws CircuitBreakingException {
|
||||
public boolean incrementAndCheckState(final Long increment) throws CircuitBreakingException {
|
||||
if (threshold == 0) {
|
||||
open();
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @throws NullPointerException if <code>listener</code> is <code>null</code>.
|
||||
* @since 3.5
|
||||
*/
|
||||
public void addListener(final L listener, boolean allowDuplicate) {
|
||||
public void addListener(final L listener, final boolean allowDuplicate) {
|
||||
Validate.notNull(listener, "Listener object cannot be null.");
|
||||
if (allowDuplicate) {
|
||||
listeners.add(listener);
|
||||
|
|
|
@ -754,7 +754,7 @@ public class ExceptionUtils {
|
|||
* @since 3.5
|
||||
* @see #wrapAndThrow(Throwable)
|
||||
*/
|
||||
public static <R> R rethrow(Throwable throwable) {
|
||||
public static <R> R rethrow(final Throwable throwable) {
|
||||
// claim that the typeErasure invocation throws a RuntimeException
|
||||
return ExceptionUtils.<R, RuntimeException> typeErasure(throwable);
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ public class ExceptionUtils {
|
|||
* clause.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <R, T extends Throwable> R typeErasure(Throwable throwable) throws T {
|
||||
private static <R, T extends Throwable> R typeErasure(final Throwable throwable) throws T {
|
||||
throw (T) throwable;
|
||||
}
|
||||
|
||||
|
@ -791,7 +791,7 @@ public class ExceptionUtils {
|
|||
* @see #rethrow(Throwable)
|
||||
* @see #hasCause(Throwable, Class)
|
||||
*/
|
||||
public static <R> R wrapAndThrow(Throwable throwable) {
|
||||
public static <R> R wrapAndThrow(final Throwable throwable) {
|
||||
if (throwable instanceof RuntimeException) {
|
||||
throw (RuntimeException) throwable;
|
||||
}
|
||||
|
@ -815,7 +815,7 @@ public class ExceptionUtils {
|
|||
* @see #wrapAndThrow(Throwable)
|
||||
*/
|
||||
public static boolean hasCause(Throwable chain,
|
||||
Class<? extends Throwable> type) {
|
||||
final Class<? extends Throwable> type) {
|
||||
if (chain instanceof UndeclaredThrowableException) {
|
||||
chain = chain.getCause();
|
||||
}
|
||||
|
|
|
@ -1576,7 +1576,7 @@ public class NumberUtils {
|
|||
* a value greater than {@code 0} if {@code x > y}
|
||||
* @since 3.4
|
||||
*/
|
||||
public static int compare(int x, int y) {
|
||||
public static int compare(final int x, final int y) {
|
||||
if (x == y) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1593,7 +1593,7 @@ public class NumberUtils {
|
|||
* a value greater than {@code 0} if {@code x > y}
|
||||
* @since 3.4
|
||||
*/
|
||||
public static int compare(long x, long y) {
|
||||
public static int compare(final long x, final long y) {
|
||||
if (x == y) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1610,7 +1610,7 @@ public class NumberUtils {
|
|||
* a value greater than {@code 0} if {@code x > y}
|
||||
* @since 3.4
|
||||
*/
|
||||
public static int compare(short x, short y) {
|
||||
public static int compare(final short x, final short y) {
|
||||
if (x == y) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1627,7 +1627,7 @@ public class NumberUtils {
|
|||
* a value greater than {@code 0} if {@code x > y}
|
||||
* @since 3.4
|
||||
*/
|
||||
public static int compare(byte x, byte y) {
|
||||
public static int compare(final byte x, final byte y) {
|
||||
return x - y;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -247,15 +247,15 @@ abstract class MemberUtils {
|
|||
return cost;
|
||||
}
|
||||
|
||||
static boolean isMatchingMethod(Method method, Class<?>[] parameterTypes) {
|
||||
static boolean isMatchingMethod(final Method method, final Class<?>[] parameterTypes) {
|
||||
return MemberUtils.isMatchingExecutable(Executable.of(method), parameterTypes);
|
||||
}
|
||||
|
||||
static boolean isMatchingConstructor(Constructor<?> method, Class<?>[] parameterTypes) {
|
||||
static boolean isMatchingConstructor(final Constructor<?> method, final Class<?>[] parameterTypes) {
|
||||
return MemberUtils.isMatchingExecutable(Executable.of(method), parameterTypes);
|
||||
}
|
||||
|
||||
private static boolean isMatchingExecutable(Executable method, Class<?>[] parameterTypes) {
|
||||
private static boolean isMatchingExecutable(final Executable method, final Class<?>[] parameterTypes) {
|
||||
final Class<?>[] methodParameterTypes = method.getParameterTypes();
|
||||
if (method.isVarArgs()) {
|
||||
int i;
|
||||
|
@ -283,15 +283,15 @@ abstract class MemberUtils {
|
|||
private final Class<?>[] parameterTypes;
|
||||
private final boolean isVarArgs;
|
||||
|
||||
private static Executable of(Method method) { return new Executable(method); }
|
||||
private static Executable of(Constructor<?> constructor) { return new Executable(constructor); }
|
||||
private static Executable of(final Method method) { return new Executable(method); }
|
||||
private static Executable of(final Constructor<?> constructor) { return new Executable(constructor); }
|
||||
|
||||
private Executable(Method method) {
|
||||
private Executable(final Method method) {
|
||||
parameterTypes = method.getParameterTypes();
|
||||
isVarArgs = method.isVarArgs();
|
||||
}
|
||||
|
||||
private Executable(Constructor<?> constructor) {
|
||||
private Executable(final Constructor<?> constructor) {
|
||||
parameterTypes = constructor.getParameterTypes();
|
||||
isVarArgs = constructor.isVarArgs();
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ public class MethodUtils {
|
|||
* @throws IllegalAccessException if the requested method is not accessible via reflection
|
||||
*/
|
||||
public static Object invokeMethod(final Object object, final String methodName,
|
||||
Object[] args, Class<?>[] parameterTypes)
|
||||
final Object[] args, final Class<?>[] parameterTypes)
|
||||
throws NoSuchMethodException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
return invokeMethod(object, false, methodName, args, parameterTypes);
|
||||
|
@ -444,7 +444,7 @@ public class MethodUtils {
|
|||
return method.invoke(null, args);
|
||||
}
|
||||
|
||||
private static Object[] toVarArgs(Method method, Object[] args) {
|
||||
private static Object[] toVarArgs(final Method method, Object[] args) {
|
||||
if (method.isVarArgs()) {
|
||||
Class<?>[] methodParameterTypes = method.getParameterTypes();
|
||||
args = getVarArgs(args, methodParameterTypes);
|
||||
|
@ -462,7 +462,7 @@ public class MethodUtils {
|
|||
* @return an array of the variadic arguments passed to the method
|
||||
* @since 3.5
|
||||
*/
|
||||
static Object[] getVarArgs(Object[] args, Class<?>[] methodParameterTypes) {
|
||||
static Object[] getVarArgs(final Object[] args, final Class<?>[] methodParameterTypes) {
|
||||
if (args.length == methodParameterTypes.length
|
||||
&& args[args.length - 1].getClass().equals(methodParameterTypes[methodParameterTypes.length - 1])) {
|
||||
// The args array is already in the canonical form for the method.
|
||||
|
@ -750,7 +750,7 @@ public class MethodUtils {
|
|||
* @param toClassArray
|
||||
* @return the aggregate number of inheritance hops between assignable argument class types.
|
||||
*/
|
||||
private static int distance(Class<?>[] classArray, Class<?>[] toClassArray) {
|
||||
private static int distance(final Class<?>[] classArray, final Class<?>[] toClassArray) {
|
||||
int answer = 0;
|
||||
|
||||
if (!ClassUtils.isAssignable(classArray, toClassArray, true)) {
|
||||
|
|
|
@ -166,7 +166,7 @@ public abstract class StrLookup<V> {
|
|||
* {@inheritDoc} This implementation directly accesses system properties.
|
||||
*/
|
||||
@Override
|
||||
public String lookup(String key) {
|
||||
public String lookup(final String key) {
|
||||
if (key.length() > 0) {
|
||||
try {
|
||||
return System.getProperty(key);
|
||||
|
|
|
@ -172,7 +172,7 @@ public class WordUtils {
|
|||
* @param wrapLongWords true if long words (such as URLs) should be wrapped
|
||||
* @return a line with newlines inserted, <code>null</code> if null input
|
||||
*/
|
||||
public static String wrap(final String str, int wrapLength, String newLineStr, final boolean wrapLongWords) {
|
||||
public static String wrap(final String str, final int wrapLength, final String newLineStr, final boolean wrapLongWords) {
|
||||
return wrap(str, wrapLength, newLineStr, wrapLongWords, " ");
|
||||
}
|
||||
|
||||
|
@ -698,7 +698,7 @@ public class WordUtils {
|
|||
* @return {@code true} if all search words are found, {@code false} otherwise
|
||||
* @since 3.5
|
||||
*/
|
||||
public static boolean containsAllWords(CharSequence word, CharSequence... words) {
|
||||
public static boolean containsAllWords(final CharSequence word, final CharSequence... words) {
|
||||
if (StringUtils.isEmpty(word) || ArrayUtils.isEmpty(words)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class CalendarReflection {
|
|||
private static final Method IS_WEEK_DATE_SUPPORTED = getCalendarMethod("isWeekDateSupported");
|
||||
private static final Method GET_WEEK_YEAR = getCalendarMethod("getWeekYear");
|
||||
|
||||
private static Method getCalendarMethod(String methodName, Class<?>... argTypes) {
|
||||
private static Method getCalendarMethod(final String methodName, final Class<?>... argTypes) {
|
||||
try {
|
||||
Method m = Calendar.class.getMethod(methodName, argTypes);
|
||||
return m;
|
||||
|
@ -44,7 +44,7 @@ class CalendarReflection {
|
|||
* @param calendar The calendar instance.
|
||||
* @return false, if runtime is less than java 1.7; otherwise, the result of calendar.isWeekDateSupported().
|
||||
*/
|
||||
static boolean isWeekDateSupported(Calendar calendar) {
|
||||
static boolean isWeekDateSupported(final Calendar calendar) {
|
||||
try {
|
||||
return IS_WEEK_DATE_SUPPORTED!=null && ((Boolean)IS_WEEK_DATE_SUPPORTED.invoke(calendar)).booleanValue();
|
||||
} catch (Exception e) {
|
||||
|
@ -68,7 +68,7 @@ class CalendarReflection {
|
|||
* @param calendar The calendar instance.
|
||||
* @return the week year or year value.
|
||||
*/
|
||||
public static int getWeekYear(Calendar calendar) {
|
||||
public static int getWeekYear(final Calendar calendar) {
|
||||
try {
|
||||
if (isWeekDateSupported(calendar)) {
|
||||
return (Integer) GET_WEEK_YEAR.invoke(calendar);
|
||||
|
|
|
@ -96,7 +96,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
// all entries must be lowercase by locale.
|
||||
private static final Comparator<String> LONGER_FIRST_LOWERCASE = new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String left, String right) {
|
||||
public int compare(final String left, final String right) {
|
||||
return right.compareTo(left);
|
||||
}
|
||||
};
|
||||
|
@ -182,12 +182,12 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
final Strategy strategy;
|
||||
final int width;
|
||||
|
||||
StrategyAndWidth(Strategy strategy, int width) {
|
||||
StrategyAndWidth(final Strategy strategy, final int width) {
|
||||
this.strategy = strategy;
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
int getMaxWidth(ListIterator<StrategyAndWidth> lt) {
|
||||
int getMaxWidth(final ListIterator<StrategyAndWidth> lt) {
|
||||
if(!strategy.isNumber() || !lt.hasNext()) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
final private Calendar definingCalendar;
|
||||
private int currentIdx;
|
||||
|
||||
StrategyParser(String pattern, Calendar definingCalendar) {
|
||||
StrategyParser(final String pattern, final Calendar definingCalendar) {
|
||||
this.pattern = pattern;
|
||||
this.definingCalendar = definingCalendar;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
return literal();
|
||||
}
|
||||
|
||||
private StrategyAndWidth letterPattern(char c) {
|
||||
private StrategyAndWidth letterPattern(final char c) {
|
||||
int begin = currentIdx;
|
||||
while (++currentIdx < pattern.length()) {
|
||||
if (pattern.charAt(currentIdx) != c) {
|
||||
|
@ -259,7 +259,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean isFormatLetter(char c) {
|
||||
private static boolean isFormatLetter(final char c) {
|
||||
return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z';
|
||||
}
|
||||
|
||||
|
@ -463,7 +463,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param regex The regular expression to build
|
||||
* @return The map of string display names to field values
|
||||
*/
|
||||
private static Map<String, Integer> appendDisplayNames(Calendar cal, Locale locale, int field, StringBuilder regex) {
|
||||
private static Map<String, Integer> appendDisplayNames(final Calendar cal, final Locale locale, final int field, final StringBuilder regex) {
|
||||
Map<String, Integer> values = new HashMap<>();
|
||||
|
||||
Map<String, Integer> displayNames = cal.getDisplayNames(field, Calendar.ALL_STYLES, locale);
|
||||
|
@ -514,11 +514,11 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
|
||||
private Pattern pattern;
|
||||
|
||||
void createPattern(StringBuilder regex) {
|
||||
void createPattern(final StringBuilder regex) {
|
||||
createPattern(regex.toString());
|
||||
}
|
||||
|
||||
void createPattern(String regex) {
|
||||
void createPattern(final String regex) {
|
||||
this.pattern = Pattern.compile(regex);
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
boolean parse(FastDateParser parser, Calendar calendar, String source, ParsePosition pos, int maxWidth) {
|
||||
boolean parse(final FastDateParser parser, final Calendar calendar, final String source, final ParsePosition pos, final int maxWidth) {
|
||||
Matcher matcher = pattern.matcher(source.substring(pos.getIndex()));
|
||||
if (!matcher.lookingAt()) {
|
||||
pos.setErrorIndex(pos.getIndex());
|
||||
|
@ -554,7 +554,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param definingCalendar The calendar to obtain the short and long values
|
||||
* @return The Strategy that will handle parsing for the field
|
||||
*/
|
||||
private Strategy getStrategy(char f, int width, final Calendar definingCalendar) {
|
||||
private Strategy getStrategy(final char f, final int width, final Calendar definingCalendar) {
|
||||
switch(f) {
|
||||
default:
|
||||
throw new IllegalArgumentException("Format '"+f+"' not supported");
|
||||
|
@ -669,7 +669,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
boolean parse(FastDateParser parser, Calendar calendar, String source, ParsePosition pos, int maxWidth) {
|
||||
boolean parse(final FastDateParser parser, final Calendar calendar, final String source, final ParsePosition pos, final int maxWidth) {
|
||||
for (int idx = 0; idx < formatField.length(); ++idx) {
|
||||
int sIdx = idx + pos.getIndex();
|
||||
if (sIdx == source.length()) {
|
||||
|
@ -716,7 +716,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
void setCalendar(FastDateParser parser, Calendar cal, String value) {
|
||||
void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
|
||||
final Integer iVal = lKeyValues.get(value.toLowerCase(locale));
|
||||
cal.set(field, iVal.intValue());
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
boolean parse(FastDateParser parser, Calendar calendar, String source, ParsePosition pos, int maxWidth) {
|
||||
boolean parse(final FastDateParser parser, final Calendar calendar, final String source, final ParsePosition pos, final int maxWidth) {
|
||||
int idx = pos.getIndex();
|
||||
int last = source.length();
|
||||
|
||||
|
@ -791,7 +791,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param iValue The parsed integer
|
||||
* @return The modified value
|
||||
*/
|
||||
int modify(FastDateParser parser, final int iValue) {
|
||||
int modify(final FastDateParser parser, final int iValue) {
|
||||
return iValue;
|
||||
}
|
||||
|
||||
|
@ -802,7 +802,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
int modify(FastDateParser parser, final int iValue) {
|
||||
int modify(final FastDateParser parser, final int iValue) {
|
||||
return iValue < 100 ? parser.adjustYear(iValue) : iValue;
|
||||
}
|
||||
};
|
||||
|
@ -821,7 +821,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
TimeZone zone;
|
||||
int dstOffset;
|
||||
|
||||
TzInfo(TimeZone tz, boolean useDst) {
|
||||
TzInfo(final TimeZone tz, final boolean useDst) {
|
||||
zone = tz;
|
||||
dstOffset = useDst ?tz.getDSTSavings() :0;
|
||||
}
|
||||
|
@ -909,7 +909,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* Construct a Strategy that parses a TimeZone
|
||||
* @param pattern The Pattern
|
||||
*/
|
||||
ISO8601TimeZoneStrategy(String pattern) {
|
||||
ISO8601TimeZoneStrategy(final String pattern) {
|
||||
createPattern(pattern);
|
||||
}
|
||||
|
||||
|
@ -917,7 +917,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
void setCalendar(FastDateParser parser, Calendar cal, String value) {
|
||||
void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
|
||||
if (value.equals("Z")) {
|
||||
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
} else {
|
||||
|
@ -936,7 +936,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @return a ISO8601TimeZoneStrategy that can format TimeZone String of length {@code tokenLen}. If no such
|
||||
* strategy exists, an IllegalArgumentException will be thrown.
|
||||
*/
|
||||
static Strategy getStrategy(int tokenLen) {
|
||||
static Strategy getStrategy(final int tokenLen) {
|
||||
switch(tokenLen) {
|
||||
case 1:
|
||||
return ISO_8601_1_STRATEGY;
|
||||
|
@ -952,7 +952,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
|
||||
private static final Strategy NUMBER_MONTH_STRATEGY = new NumberStrategy(Calendar.MONTH) {
|
||||
@Override
|
||||
int modify(FastDateParser parser, final int iValue) {
|
||||
int modify(final FastDateParser parser, final int iValue) {
|
||||
return iValue-1;
|
||||
}
|
||||
};
|
||||
|
@ -963,7 +963,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
private static final Strategy DAY_OF_MONTH_STRATEGY = new NumberStrategy(Calendar.DAY_OF_MONTH);
|
||||
private static final Strategy DAY_OF_WEEK_STRATEGY = new NumberStrategy(Calendar.DAY_OF_WEEK) {
|
||||
@Override
|
||||
int modify(FastDateParser parser, final int iValue) {
|
||||
int modify(final FastDateParser parser, final int iValue) {
|
||||
return iValue != 7 ? iValue + 1 : Calendar.SUNDAY;
|
||||
}
|
||||
};
|
||||
|
@ -971,13 +971,13 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
private static final Strategy HOUR_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY);
|
||||
private static final Strategy HOUR24_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY) {
|
||||
@Override
|
||||
int modify(FastDateParser parser, final int iValue) {
|
||||
int modify(final FastDateParser parser, final int iValue) {
|
||||
return iValue == 24 ? 0 : iValue;
|
||||
}
|
||||
};
|
||||
private static final Strategy HOUR12_STRATEGY = new NumberStrategy(Calendar.HOUR) {
|
||||
@Override
|
||||
int modify(FastDateParser parser, final int iValue) {
|
||||
int modify(final FastDateParser parser, final int iValue) {
|
||||
return iValue == 12 ? 0 : iValue;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -423,7 +423,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @param obj the object to format
|
||||
* @return The formatted value.
|
||||
*/
|
||||
String format(Object obj) {
|
||||
String format(final Object obj) {
|
||||
if (obj instanceof Date) {
|
||||
return format((Date) obj);
|
||||
} else if (obj instanceof Calendar) {
|
||||
|
@ -1031,7 +1031,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final void appendTo(final Appendable buffer, int value) throws IOException {
|
||||
public final void appendTo(final Appendable buffer, final int value) throws IOException {
|
||||
appendFullDigits(buffer, value, mSize);
|
||||
}
|
||||
}
|
||||
|
@ -1449,7 +1449,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @return a Iso8601_Rule that can format TimeZone String of length {@code tokenLen}. If no such
|
||||
* rule exists, an IllegalArgumentException will be thrown.
|
||||
*/
|
||||
static Iso8601_Rule getRule(int tokenLen) {
|
||||
static Iso8601_Rule getRule(final int tokenLen) {
|
||||
switch(tokenLen) {
|
||||
case 1:
|
||||
return Iso8601_Rule.ISO8601_HOURS;
|
||||
|
|
|
@ -2958,7 +2958,7 @@ public class ArrayUtilsTest {
|
|||
public void testContains_LANG_1261() {
|
||||
class LANG1261ParentObject {
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(final Object o) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4288,7 +4288,7 @@ public class ArrayUtilsTest {
|
|||
@Test
|
||||
public void testIsSortedComparator() {
|
||||
Comparator<Integer> c = new Comparator<Integer>() {
|
||||
public int compare(Integer o1, Integer o2) {
|
||||
public int compare(final Integer o1, final Integer o2) {
|
||||
return o2.compareTo(o1);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -82,8 +82,8 @@ public class CharSequenceUtilsTest {
|
|||
final int len;
|
||||
final boolean expected;
|
||||
final Class<?> throwable;
|
||||
TestData(String source, boolean ignoreCase, int toffset,
|
||||
String other, int ooffset, int len, boolean expected){
|
||||
TestData(final String source, final boolean ignoreCase, final int toffset,
|
||||
final String other, final int ooffset, final int len, final boolean expected){
|
||||
this.source = source;
|
||||
this.ignoreCase = ignoreCase;
|
||||
this.toffset = toffset;
|
||||
|
@ -93,8 +93,8 @@ public class CharSequenceUtilsTest {
|
|||
this.expected = expected;
|
||||
this.throwable = null;
|
||||
}
|
||||
TestData(String source, boolean ignoreCase, int toffset,
|
||||
String other, int ooffset, int len, Class<?> throwable){
|
||||
TestData(final String source, final boolean ignoreCase, final int toffset,
|
||||
final String other, final int ooffset, final int len, final Class<?> throwable){
|
||||
this.source = source;
|
||||
this.ignoreCase = ignoreCase;
|
||||
this.toffset = toffset;
|
||||
|
@ -140,7 +140,7 @@ public class CharSequenceUtilsTest {
|
|||
|
||||
abstract boolean invoke();
|
||||
|
||||
void run(TestData data, String id) {
|
||||
void run(final TestData data, final String id) {
|
||||
if (data.throwable != null) {
|
||||
try {
|
||||
invoke();
|
||||
|
|
|
@ -1153,7 +1153,7 @@ public class EqualsBuilderTest {
|
|||
private final int a;
|
||||
private final int b;
|
||||
|
||||
public TestObjectEqualsExclude(int a, int b) {
|
||||
public TestObjectEqualsExclude(final int a, final int b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
|
|
@ -568,7 +568,7 @@ public class HashCodeBuilderTest {
|
|||
private final int a;
|
||||
private final int b;
|
||||
|
||||
public TestObjectHashCodeExclude(int a, int b) {
|
||||
public TestObjectHashCodeExclude(final int a, final int b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ public class HashCodeBuilderTest {
|
|||
@HashCodeExclude
|
||||
private final int b;
|
||||
|
||||
public TestObjectHashCodeExclude2(int a, int b) {
|
||||
public TestObjectHashCodeExclude2(final int a, final int b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
|
|
@ -202,11 +202,11 @@ public class MultilineRecursiveToStringStyleTest {
|
|||
assertEquals(exp, toString(wa));
|
||||
}
|
||||
|
||||
private String getClassPrefix(Object object) {
|
||||
private String getClassPrefix(final Object object) {
|
||||
return object.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(object));
|
||||
}
|
||||
|
||||
private String toString(Object object) {
|
||||
private String toString(final Object object) {
|
||||
return new ReflectionToStringBuilder(object, new MultilineRecursiveToStringStyle()).toString();
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ public class MultilineRecursiveToStringStyleTest {
|
|||
static class Bank {
|
||||
String name;
|
||||
|
||||
public Bank(String name) {
|
||||
public Bank(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ public class MultilineRecursiveToStringStyleTest {
|
|||
Bank bank;
|
||||
List<Account> accounts;
|
||||
|
||||
public Customer(String name) {
|
||||
public Customer(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ public class MultilineRecursiveToStringStyleTest {
|
|||
double amount;
|
||||
String date;
|
||||
|
||||
public Transaction(String datum, double betrag) {
|
||||
public Transaction(final String datum, final double betrag) {
|
||||
this.date = datum;
|
||||
this.amount = betrag;
|
||||
}
|
||||
|
|
|
@ -330,9 +330,9 @@ public class EventCountCircuitBreakerTest {
|
|||
/** The current time in nanoseconds. */
|
||||
private long currentTime;
|
||||
|
||||
public EventCountCircuitBreakerTestImpl(int openingThreshold, long openingInterval,
|
||||
TimeUnit openingUnit, int closingThreshold, long closingInterval,
|
||||
TimeUnit closingUnit) {
|
||||
public EventCountCircuitBreakerTestImpl(final int openingThreshold, final long openingInterval,
|
||||
final TimeUnit openingUnit, final int closingThreshold, final long closingInterval,
|
||||
final TimeUnit closingUnit) {
|
||||
super(openingThreshold, openingInterval, openingUnit, closingThreshold,
|
||||
closingInterval, closingUnit);
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ public class EventCountCircuitBreakerTest {
|
|||
* @param time the time to set
|
||||
* @return a reference to this object
|
||||
*/
|
||||
public EventCountCircuitBreakerTestImpl at(long time) {
|
||||
public EventCountCircuitBreakerTestImpl at(final long time) {
|
||||
currentTime = time;
|
||||
return this;
|
||||
}
|
||||
|
@ -374,12 +374,12 @@ public class EventCountCircuitBreakerTest {
|
|||
*
|
||||
* @param source the expected event source
|
||||
*/
|
||||
public ChangeListener(Object source) {
|
||||
public ChangeListener(final Object source) {
|
||||
expectedSource = source;
|
||||
changedValues = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
public void propertyChange(final PropertyChangeEvent evt) {
|
||||
assertEquals("Wrong event source", expectedSource, evt.getSource());
|
||||
assertEquals("Wrong property name", "open", evt.getPropertyName());
|
||||
Boolean newValue = (Boolean) evt.getNewValue();
|
||||
|
@ -393,7 +393,7 @@ public class EventCountCircuitBreakerTest {
|
|||
*
|
||||
* @param values the expected values
|
||||
*/
|
||||
public void verify(Boolean... values) {
|
||||
public void verify(final Boolean... values) {
|
||||
assertArrayEquals(values,
|
||||
changedValues.toArray(new Boolean[changedValues.size()]));
|
||||
}
|
||||
|
|
|
@ -546,7 +546,7 @@ public class TimedSemaphoreTest {
|
|||
/** Flag whether a permit could be acquired. */
|
||||
private boolean acquired;
|
||||
|
||||
public TryAcquireThread(TimedSemaphore s, CountDownLatch l) {
|
||||
public TryAcquireThread(final TimedSemaphore s, final CountDownLatch l) {
|
||||
semaphore = s;
|
||||
latch = l;
|
||||
}
|
||||
|
|
|
@ -77,12 +77,12 @@ public class ConstructorUtilsTest {
|
|||
varArgs = s;
|
||||
}
|
||||
|
||||
public TestBean(final Integer i, String... s) {
|
||||
public TestBean(final Integer i, final String... s) {
|
||||
toString = "(Integer, String...)";
|
||||
varArgs = s;
|
||||
}
|
||||
|
||||
public TestBean(final Integer first, int... args) {
|
||||
public TestBean(final Integer first, final int... args) {
|
||||
toString = "(Integer, String...)";
|
||||
varArgs = new String[args.length];
|
||||
for(int i = 0; i< args.length; ++i) {
|
||||
|
|
|
@ -179,57 +179,57 @@ public class MethodUtilsTest {
|
|||
return "foo(Object...)";
|
||||
}
|
||||
|
||||
public int[] unboxing(int... values) {
|
||||
public int[] unboxing(final int... values) {
|
||||
return values;
|
||||
}
|
||||
|
||||
// This method is overloaded for the wrapper class for every primitive type, plus the common supertypes
|
||||
// Number and Object. This is an acid test since it easily leads to ambiguous methods.
|
||||
public static String varOverload(Byte... args) { return "Byte..."; }
|
||||
public static String varOverload(Character... args) { return "Character..."; }
|
||||
public static String varOverload(Short... args) { return "Short..."; }
|
||||
public static String varOverload(Boolean... args) { return "Boolean..."; }
|
||||
public static String varOverload(Float... args) { return "Float..."; }
|
||||
public static String varOverload(Double... args) { return "Double..."; }
|
||||
public static String varOverload(Integer... args) { return "Integer..."; }
|
||||
public static String varOverload(Long... args) { return "Long..."; }
|
||||
public static String varOverload(Number... args) { return "Number..."; }
|
||||
public static String varOverload(Object... args) { return "Object..."; }
|
||||
public static String varOverload(String... args) { return "String..."; }
|
||||
public static String varOverload(final Byte... args) { return "Byte..."; }
|
||||
public static String varOverload(final Character... args) { return "Character..."; }
|
||||
public static String varOverload(final Short... args) { return "Short..."; }
|
||||
public static String varOverload(final Boolean... args) { return "Boolean..."; }
|
||||
public static String varOverload(final Float... args) { return "Float..."; }
|
||||
public static String varOverload(final Double... args) { return "Double..."; }
|
||||
public static String varOverload(final Integer... args) { return "Integer..."; }
|
||||
public static String varOverload(final Long... args) { return "Long..."; }
|
||||
public static String varOverload(final Number... args) { return "Number..."; }
|
||||
public static String varOverload(final Object... args) { return "Object..."; }
|
||||
public static String varOverload(final String... args) { return "String..."; }
|
||||
|
||||
// This method is overloaded for the wrapper class for every numeric primitive type, plus the common
|
||||
// supertype Number
|
||||
public static String numOverload(Byte... args) { return "Byte..."; }
|
||||
public static String numOverload(Short... args) { return "Short..."; }
|
||||
public static String numOverload(Float... args) { return "Float..."; }
|
||||
public static String numOverload(Double... args) { return "Double..."; }
|
||||
public static String numOverload(Integer... args) { return "Integer..."; }
|
||||
public static String numOverload(Long... args) { return "Long..."; }
|
||||
public static String numOverload(Number... args) { return "Number..."; }
|
||||
public static String numOverload(final Byte... args) { return "Byte..."; }
|
||||
public static String numOverload(final Short... args) { return "Short..."; }
|
||||
public static String numOverload(final Float... args) { return "Float..."; }
|
||||
public static String numOverload(final Double... args) { return "Double..."; }
|
||||
public static String numOverload(final Integer... args) { return "Integer..."; }
|
||||
public static String numOverload(final Long... args) { return "Long..."; }
|
||||
public static String numOverload(final Number... args) { return "Number..."; }
|
||||
|
||||
// These varOverloadEcho and varOverloadEchoStatic methods are designed to verify that
|
||||
// not only is the correct overloaded variant invoked, but that the varags arguments
|
||||
// are also delivered correctly to the method.
|
||||
public ImmutablePair<String, Object[]> varOverloadEcho(String... args) {
|
||||
public ImmutablePair<String, Object[]> varOverloadEcho(final String... args) {
|
||||
return new ImmutablePair<String, Object[]>("String...", args);
|
||||
}
|
||||
public ImmutablePair<String, Object[]> varOverloadEcho(Number... args) {
|
||||
public ImmutablePair<String, Object[]> varOverloadEcho(final Number... args) {
|
||||
return new ImmutablePair<String, Object[]>("Number...", args);
|
||||
}
|
||||
|
||||
public static ImmutablePair<String, Object[]> varOverloadEchoStatic(String... args) {
|
||||
public static ImmutablePair<String, Object[]> varOverloadEchoStatic(final String... args) {
|
||||
return new ImmutablePair<String, Object[]>("String...", args);
|
||||
}
|
||||
public static ImmutablePair<String, Object[]> varOverloadEchoStatic(Number... args) {
|
||||
public static ImmutablePair<String, Object[]> varOverloadEchoStatic(final Number... args) {
|
||||
return new ImmutablePair<String, Object[]>("Number...", args);
|
||||
}
|
||||
|
||||
static void verify(ImmutablePair<String, Object[]> a, ImmutablePair<String, Object[]> b) {
|
||||
static void verify(final ImmutablePair<String, Object[]> a, final ImmutablePair<String, Object[]> b) {
|
||||
assertEquals(a.getLeft(), b.getLeft());
|
||||
assertArrayEquals(a.getRight(), b.getRight());
|
||||
}
|
||||
|
||||
static void verify(ImmutablePair<String, Object[]> a, Object _b) {
|
||||
static void verify(final ImmutablePair<String, Object[]> a, final Object _b) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final ImmutablePair<String, Object[]> b = (ImmutablePair<String, Object[]>) _b;
|
||||
verify(a, b);
|
||||
|
|
|
@ -40,7 +40,7 @@ public class NotVisibleExceptionFactory {
|
|||
|
||||
private final Throwable cause;
|
||||
|
||||
private NotVisibleException(Throwable cause) {
|
||||
private NotVisibleException(final Throwable cause) {
|
||||
this.cause = cause;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ import org.junit.runners.model.Statement;
|
|||
public class SystemDefaultsSwitch implements TestRule {
|
||||
|
||||
@Override
|
||||
public Statement apply(Statement stmt, Description description) {
|
||||
public Statement apply(final Statement stmt, final Description description) {
|
||||
SystemDefaults defaults = description.getAnnotation(SystemDefaults.class);
|
||||
if (defaults == null) {
|
||||
return stmt;
|
||||
|
@ -68,7 +68,7 @@ public class SystemDefaultsSwitch implements TestRule {
|
|||
return applyTimeZone(defaults, applyLocale(defaults, stmt));
|
||||
}
|
||||
|
||||
private Statement applyTimeZone(SystemDefaults defaults, final Statement stmt) {
|
||||
private Statement applyTimeZone(final SystemDefaults defaults, final Statement stmt) {
|
||||
if (defaults.timezone().isEmpty()) {
|
||||
return stmt;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class SystemDefaultsSwitch implements TestRule {
|
|||
};
|
||||
}
|
||||
|
||||
private Statement applyLocale(SystemDefaults defaults, final Statement stmt) {
|
||||
private Statement applyLocale(final SystemDefaults defaults, final Statement stmt) {
|
||||
if (defaults.locale().isEmpty()) {
|
||||
return stmt;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public class DateFormatUtilsTest {
|
|||
assertEquals ("2005-01-01T12:00:00", DateFormatUtils.formatUTC(c.getTime().getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), Locale.US));
|
||||
}
|
||||
|
||||
private void assertFormats(String expectedValue, String pattern, TimeZone timeZone, Calendar cal) {
|
||||
private void assertFormats(final String expectedValue, final String pattern, final TimeZone timeZone, final Calendar cal) {
|
||||
assertEquals(expectedValue, DateFormatUtils.format(cal.getTime(), pattern, timeZone));
|
||||
assertEquals(expectedValue, DateFormatUtils.format(cal.getTime().getTime(), pattern, timeZone));
|
||||
assertEquals(expectedValue, DateFormatUtils.format(cal, pattern, timeZone));
|
||||
|
@ -133,12 +133,12 @@ public class DateFormatUtilsTest {
|
|||
return cal;
|
||||
}
|
||||
|
||||
private void testGmtMinus3(String expectedValue, String pattern) {
|
||||
private void testGmtMinus3(final String expectedValue, final String pattern) {
|
||||
final TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
|
||||
assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));
|
||||
}
|
||||
|
||||
private void testUTC(String expectedValue, String pattern) {
|
||||
private void testUTC(final String expectedValue, final String pattern) {
|
||||
final TimeZone timeZone = TimeZone.getTimeZone("UTC");
|
||||
assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));
|
||||
}
|
||||
|
|
|
@ -229,16 +229,16 @@ public class FastDateFormatTest {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public StringBuffer format(Object obj,
|
||||
StringBuffer toAppendTo,
|
||||
FieldPosition fieldPosition) {
|
||||
public StringBuffer format(final Object obj,
|
||||
final StringBuffer toAppendTo,
|
||||
final FieldPosition fieldPosition) {
|
||||
synchronized(this) {
|
||||
return inner.format(obj, toAppendTo, fieldPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object parseObject(String source, ParsePosition pos) {
|
||||
public Object parseObject(final String source, final ParsePosition pos) {
|
||||
synchronized(this) {
|
||||
return inner.parseObject(source, pos);
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public class FastDateParserSDFTest {
|
|||
private final boolean valid;
|
||||
private final TimeZone timeZone = TimeZone.getDefault();
|
||||
|
||||
public FastDateParserSDFTest(String format, String input, Locale locale, boolean valid) {
|
||||
public FastDateParserSDFTest(final String format, final String input, final Locale locale, final boolean valid) {
|
||||
this.format = format;
|
||||
this.input = input;
|
||||
this.locale = locale;
|
||||
|
|
|
@ -611,7 +611,7 @@ public class FastDateParserTest {
|
|||
getInstance("XXXX");
|
||||
}
|
||||
|
||||
private static Calendar initializeCalendar(TimeZone tz) {
|
||||
private static Calendar initializeCalendar(final TimeZone tz) {
|
||||
Calendar cal = Calendar.getInstance(tz);
|
||||
cal.set(Calendar.YEAR, 2001);
|
||||
cal.set(Calendar.MONTH, 1); // not daylight savings
|
||||
|
@ -628,7 +628,7 @@ public class FastDateParserTest {
|
|||
Greenwich(GMT, "Z", "Z", "Z", false),
|
||||
NewYork(NEW_YORK, "-05", "-0500", "-05:00", false);
|
||||
|
||||
private Expected1806(TimeZone zone, String one, String two, String three, boolean hasHalfHourOffset) {
|
||||
private Expected1806(final TimeZone zone, final String one, final String two, final String three, final boolean hasHalfHourOffset) {
|
||||
this.zone = zone;
|
||||
this.one = one;
|
||||
this.two = two;
|
||||
|
|
|
@ -276,7 +276,7 @@ public class FastDatePrinterTest {
|
|||
assertEquals("+00:00", colonFormat.format(c));
|
||||
}
|
||||
|
||||
private static Calendar initializeCalendar(TimeZone tz) {
|
||||
private static Calendar initializeCalendar(final TimeZone tz) {
|
||||
Calendar cal = Calendar.getInstance(tz);
|
||||
cal.set(Calendar.YEAR, 2001);
|
||||
cal.set(Calendar.MONTH, 1); // not daylight savings
|
||||
|
@ -297,7 +297,7 @@ public class FastDatePrinterTest {
|
|||
India(INDIA, "+05", "+0530", "+05:30"), Greenwich(GMT, "Z", "Z", "Z"), NewYork(
|
||||
NEW_YORK, "-05", "-0500", "-05:00");
|
||||
|
||||
private Expected1806(TimeZone zone, String one, String two, String three) {
|
||||
private Expected1806(final TimeZone zone, final String one, final String two, final String three) {
|
||||
this.zone = zone;
|
||||
this.one = one;
|
||||
this.two = two;
|
||||
|
|
|
@ -46,7 +46,7 @@ public class FastDatePrinterTimeZonesTest {
|
|||
|
||||
private final TimeZone timeZone;
|
||||
|
||||
public FastDatePrinterTimeZonesTest(TimeZone timeZone) {
|
||||
public FastDatePrinterTimeZonesTest(final TimeZone timeZone) {
|
||||
this.timeZone = timeZone;
|
||||
}
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ public class StopWatchTest {
|
|||
* @param nanos Time in nanoseconds to have elapsed on the stop watch
|
||||
* @return StopWatch in a suspended state with the elapsed time
|
||||
*/
|
||||
private StopWatch createMockStopWatch(long nanos) {
|
||||
private StopWatch createMockStopWatch(final long nanos) {
|
||||
final StopWatch watch = StopWatch.createStarted();
|
||||
watch.suspend();
|
||||
try {
|
||||
|
|
|
@ -60,7 +60,7 @@ public class WeekYearTest {
|
|||
final Calendar vulgar;
|
||||
final String isoForm;
|
||||
|
||||
public WeekYearTest(int year, int month, int day, String isoForm) {
|
||||
public WeekYearTest(final int year, final int month, final int day, final String isoForm) {
|
||||
vulgar = new GregorianCalendar(year, month, day);
|
||||
this.isoForm = isoForm;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue