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