Add final modifier to method parameters.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1436768 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
adfcc014bd
commit
5bd622dab0
|
@ -69,7 +69,7 @@ public class AnnotationUtils {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected String getShortClassName(java.lang.Class<?> cls) {
|
||||
protected String getShortClassName(final java.lang.Class<?> cls) {
|
||||
Class<? extends Annotation> annotationType = null;
|
||||
for (Class<?> iface : ClassUtils.getAllInterfaces(cls)) {
|
||||
if (Annotation.class.isAssignableFrom(iface)) {
|
||||
|
@ -87,7 +87,7 @@ public class AnnotationUtils {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, Object value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, Object value) {
|
||||
if (value instanceof Annotation) {
|
||||
value = AnnotationUtils.toString((Annotation) value);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class AnnotationUtils {
|
|||
* @return {@code true} if the two annotations are {@code equal} or both
|
||||
* {@code null}
|
||||
*/
|
||||
public static boolean equals(Annotation a1, Annotation a2) {
|
||||
public static boolean equals(final Annotation a1, final Annotation a2) {
|
||||
if (a1 == a2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public class AnnotationUtils {
|
|||
* @throws IllegalStateException if an annotation method invocation returns
|
||||
* {@code null}
|
||||
*/
|
||||
public static int hashCode(Annotation a) {
|
||||
public static int hashCode(final Annotation a) {
|
||||
int result = 0;
|
||||
Class<? extends Annotation> type = a.annotationType();
|
||||
for (Method m : type.getDeclaredMethods()) {
|
||||
|
@ -238,7 +238,7 @@ public class AnnotationUtils {
|
|||
* @param value the value of the member
|
||||
* @return a hash code for this member
|
||||
*/
|
||||
private static int hashMember(String name, Object value) {
|
||||
private static int hashMember(final String name, final Object value) {
|
||||
int part1 = name.hashCode() * 127;
|
||||
if (value.getClass().isArray()) {
|
||||
return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);
|
||||
|
@ -259,7 +259,7 @@ public class AnnotationUtils {
|
|||
* @param o2 the second object
|
||||
* @return a flag whether these objects are equal
|
||||
*/
|
||||
private static boolean memberEquals(Class<?> type, Object o1, Object o2) {
|
||||
private static boolean memberEquals(final Class<?> type, final Object o1, final Object o2) {
|
||||
if (o1 == o2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ public class AnnotationUtils {
|
|||
* @param o2 the second object
|
||||
* @return a flag whether these objects are equal
|
||||
*/
|
||||
private static boolean arrayMemberEquals(Class<?> componentType, Object o1, Object o2) {
|
||||
private static boolean arrayMemberEquals(final Class<?> componentType, final Object o1, final Object o2) {
|
||||
if (componentType.isAnnotation()) {
|
||||
return annotationArrayMemberEquals((Annotation[]) o1, (Annotation[]) o2);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ public class AnnotationUtils {
|
|||
* @param a2 the second array
|
||||
* @return a flag whether these arrays are equal
|
||||
*/
|
||||
private static boolean annotationArrayMemberEquals(Annotation[] a1, Annotation[] a2) {
|
||||
private static boolean annotationArrayMemberEquals(final Annotation[] a1, final Annotation[] a2) {
|
||||
if (a1.length != a2.length) {
|
||||
return false;
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ public class AnnotationUtils {
|
|||
* @param o the array
|
||||
* @return a hash code for the specified array
|
||||
*/
|
||||
private static int arrayMemberHash(Class<?> componentType, Object o) {
|
||||
private static int arrayMemberHash(final Class<?> componentType, final Object o) {
|
||||
if (componentType.equals(Byte.TYPE)) {
|
||||
return Arrays.hashCode((byte[]) o);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -34,7 +34,7 @@ public class BitField {
|
|||
* BitField. Bits that are set in this mask are the bits
|
||||
* that this BitField operates on
|
||||
*/
|
||||
public BitField(int mask) {
|
||||
public BitField(final int mask) {
|
||||
_mask = mask;
|
||||
int count = 0;
|
||||
int bit_pattern = mask;
|
||||
|
@ -62,7 +62,7 @@ public class BitField {
|
|||
* in
|
||||
* @return the selected bits, shifted right appropriately
|
||||
*/
|
||||
public int getValue(int holder) {
|
||||
public int getValue(final int holder) {
|
||||
return getRawValue(holder) >> _shift_count;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class BitField {
|
|||
* interested in
|
||||
* @return the selected bits, shifted right appropriately
|
||||
*/
|
||||
public short getShortValue(short holder) {
|
||||
public short getShortValue(final short holder) {
|
||||
return (short) getValue(holder);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class BitField {
|
|||
* interested in
|
||||
* @return the selected bits
|
||||
*/
|
||||
public int getRawValue(int holder) {
|
||||
public int getRawValue(final int holder) {
|
||||
return holder & _mask;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class BitField {
|
|||
* interested in
|
||||
* @return the selected bits
|
||||
*/
|
||||
public short getShortRawValue(short holder) {
|
||||
public short getShortRawValue(final short holder) {
|
||||
return (short) getRawValue(holder);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class BitField {
|
|||
* @return {@code true} if any of the bits are set,
|
||||
* else {@code false}
|
||||
*/
|
||||
public boolean isSet(int holder) {
|
||||
public boolean isSet(final int holder) {
|
||||
return (holder & _mask) != 0;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class BitField {
|
|||
* @return {@code true} if all of the bits are set,
|
||||
* else {@code false}
|
||||
*/
|
||||
public boolean isAllSet(int holder) {
|
||||
public boolean isAllSet(final int holder) {
|
||||
return (holder & _mask) == _mask;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class BitField {
|
|||
* @return the value of holder with the bits from the value
|
||||
* parameter replacing the old bits
|
||||
*/
|
||||
public int setValue(int holder, int value) {
|
||||
public int setValue(final int holder, final int value) {
|
||||
return (holder & ~_mask) | ((value << _shift_count) & _mask);
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public class BitField {
|
|||
* @return the value of holder with the bits from the value
|
||||
* parameter replacing the old bits
|
||||
*/
|
||||
public short setShortValue(short holder, short value) {
|
||||
public short setShortValue(final short holder, final short value) {
|
||||
return (short) setValue(holder, value);
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class BitField {
|
|||
* @return the value of holder with the specified bits cleared
|
||||
* (set to {@code 0})
|
||||
*/
|
||||
public int clear(int holder) {
|
||||
public int clear(final int holder) {
|
||||
return holder & ~_mask;
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ public class BitField {
|
|||
* @return the value of holder with the specified bits cleared
|
||||
* (set to {@code 0})
|
||||
*/
|
||||
public short clearShort(short holder) {
|
||||
public short clearShort(final short holder) {
|
||||
return (short) clear(holder);
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class BitField {
|
|||
* @return the value of holder with the specified bits cleared
|
||||
* (set to {@code 0})
|
||||
*/
|
||||
public byte clearByte(byte holder) {
|
||||
public byte clearByte(final byte holder) {
|
||||
return (byte) clear(holder);
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class BitField {
|
|||
* @return the value of holder with the specified bits set
|
||||
* to {@code 1}
|
||||
*/
|
||||
public int set(int holder) {
|
||||
public int set(final int holder) {
|
||||
return holder | _mask;
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ public class BitField {
|
|||
* @return the value of holder with the specified bits set
|
||||
* to {@code 1}
|
||||
*/
|
||||
public short setShort(short holder) {
|
||||
public short setShort(final short holder) {
|
||||
return (short) set(holder);
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ public class BitField {
|
|||
* @return the value of holder with the specified bits set
|
||||
* to {@code 1}
|
||||
*/
|
||||
public byte setByte(byte holder) {
|
||||
public byte setByte(final byte holder) {
|
||||
return (byte) set(holder);
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ public class BitField {
|
|||
* @return the value of holder with the specified bits set or
|
||||
* cleared
|
||||
*/
|
||||
public int setBoolean(int holder, boolean flag) {
|
||||
public int setBoolean(final int holder, final boolean flag) {
|
||||
return flag ? set(holder) : clear(holder);
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ public class BitField {
|
|||
* @return the value of holder with the specified bits set or
|
||||
* cleared
|
||||
*/
|
||||
public short setShortBoolean(short holder, boolean flag) {
|
||||
public short setShortBoolean(final short holder, final boolean flag) {
|
||||
return flag ? setShort(holder) : clearShort(holder);
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ public class BitField {
|
|||
* @return the value of holder with the specified bits set or
|
||||
* cleared
|
||||
*/
|
||||
public byte setByteBoolean(byte holder, boolean flag) {
|
||||
public byte setByteBoolean(final byte holder, final boolean flag) {
|
||||
return flag ? setByte(holder) : clearByte(holder);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class BooleanUtils {
|
|||
* @param bool the Boolean to negate, may be null
|
||||
* @return the negated Boolean, or {@code null} if {@code null} input
|
||||
*/
|
||||
public static Boolean negate(Boolean bool) {
|
||||
public static Boolean negate(final Boolean bool) {
|
||||
if (bool == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class BooleanUtils {
|
|||
* @return {@code true} only if the input is non-null and true
|
||||
* @since 2.1
|
||||
*/
|
||||
public static boolean isTrue(Boolean bool) {
|
||||
public static boolean isTrue(final Boolean bool) {
|
||||
return Boolean.TRUE.equals(bool);
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class BooleanUtils {
|
|||
* @return {@code true} if the input is null or false
|
||||
* @since 2.3
|
||||
*/
|
||||
public static boolean isNotTrue(Boolean bool) {
|
||||
public static boolean isNotTrue(final Boolean bool) {
|
||||
return !isTrue(bool);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class BooleanUtils {
|
|||
* @return {@code true} only if the input is non-null and false
|
||||
* @since 2.1
|
||||
*/
|
||||
public static boolean isFalse(Boolean bool) {
|
||||
public static boolean isFalse(final Boolean bool) {
|
||||
return Boolean.FALSE.equals(bool);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ public class BooleanUtils {
|
|||
* @return {@code true} if the input is null or true
|
||||
* @since 2.3
|
||||
*/
|
||||
public static boolean isNotFalse(Boolean bool) {
|
||||
public static boolean isNotFalse(final Boolean bool) {
|
||||
return !isFalse(bool);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class BooleanUtils {
|
|||
* @param bool the boolean to convert
|
||||
* @return {@code true} or {@code false}, {@code null} returns {@code false}
|
||||
*/
|
||||
public static boolean toBoolean(Boolean bool) {
|
||||
public static boolean toBoolean(final Boolean bool) {
|
||||
return bool != null && bool.booleanValue();
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ public class BooleanUtils {
|
|||
* @param valueIfNull the boolean value to return if {@code null}
|
||||
* @return {@code true} or {@code false}
|
||||
*/
|
||||
public static boolean toBooleanDefaultIfNull(Boolean bool, boolean valueIfNull) {
|
||||
public static boolean toBooleanDefaultIfNull(final Boolean bool, final boolean valueIfNull) {
|
||||
if (bool == null) {
|
||||
return valueIfNull;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public class BooleanUtils {
|
|||
* @return {@code true} if non-zero, {@code false}
|
||||
* if zero
|
||||
*/
|
||||
public static boolean toBoolean(int value) {
|
||||
public static boolean toBoolean(final int value) {
|
||||
return value != 0;
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class BooleanUtils {
|
|||
* @return Boolean.TRUE if non-zero, Boolean.FALSE if zero,
|
||||
* {@code null} if {@code null}
|
||||
*/
|
||||
public static Boolean toBooleanObject(int value) {
|
||||
public static Boolean toBooleanObject(final int value) {
|
||||
return value == 0 ? Boolean.FALSE : Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ public class BooleanUtils {
|
|||
* @return Boolean.TRUE if non-zero, Boolean.FALSE if zero,
|
||||
* {@code null} if {@code null} input
|
||||
*/
|
||||
public static Boolean toBooleanObject(Integer value) {
|
||||
public static Boolean toBooleanObject(final Integer value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ public class BooleanUtils {
|
|||
* @return {@code true} or {@code false}
|
||||
* @throws IllegalArgumentException if no match
|
||||
*/
|
||||
public static boolean toBoolean(int value, int trueValue, int falseValue) {
|
||||
public static boolean toBoolean(final int value, final int trueValue, final int falseValue) {
|
||||
if (value == trueValue) {
|
||||
return true;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ public class BooleanUtils {
|
|||
* @return {@code true} or {@code false}
|
||||
* @throws IllegalArgumentException if no match
|
||||
*/
|
||||
public static boolean toBoolean(Integer value, Integer trueValue, Integer falseValue) {
|
||||
public static boolean toBoolean(final Integer value, final Integer trueValue, final Integer falseValue) {
|
||||
if (value == null) {
|
||||
if (trueValue == null) {
|
||||
return true;
|
||||
|
@ -321,7 +321,7 @@ public class BooleanUtils {
|
|||
* @return Boolean.TRUE, Boolean.FALSE, or {@code null}
|
||||
* @throws IllegalArgumentException if no match
|
||||
*/
|
||||
public static Boolean toBooleanObject(int value, int trueValue, int falseValue, int nullValue) {
|
||||
public static Boolean toBooleanObject(final int value, final int trueValue, final int falseValue, final int nullValue) {
|
||||
if (value == trueValue) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ public class BooleanUtils {
|
|||
* @return Boolean.TRUE, Boolean.FALSE, or {@code null}
|
||||
* @throws IllegalArgumentException if no match
|
||||
*/
|
||||
public static Boolean toBooleanObject(Integer value, Integer trueValue, Integer falseValue, Integer nullValue) {
|
||||
public static Boolean toBooleanObject(final Integer value, final Integer trueValue, final Integer falseValue, final Integer nullValue) {
|
||||
if (value == null) {
|
||||
if (trueValue == null) {
|
||||
return Boolean.TRUE;
|
||||
|
@ -389,7 +389,7 @@ public class BooleanUtils {
|
|||
* @param bool the boolean to convert
|
||||
* @return one if {@code true}, zero if {@code false}
|
||||
*/
|
||||
public static int toInteger(boolean bool) {
|
||||
public static int toInteger(final boolean bool) {
|
||||
return bool ? 1 : 0;
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ public class BooleanUtils {
|
|||
* @param bool the boolean to convert
|
||||
* @return one if {@code true}, zero if {@code false}
|
||||
*/
|
||||
public static Integer toIntegerObject(boolean bool) {
|
||||
public static Integer toIntegerObject(final boolean bool) {
|
||||
return bool ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ public class BooleanUtils {
|
|||
* @param bool the Boolean to convert
|
||||
* @return one if Boolean.TRUE, zero if Boolean.FALSE, {@code null} if {@code null}
|
||||
*/
|
||||
public static Integer toIntegerObject(Boolean bool) {
|
||||
public static Integer toIntegerObject(final Boolean bool) {
|
||||
if (bool == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ public class BooleanUtils {
|
|||
* @param falseValue the value to return if {@code false}
|
||||
* @return the appropriate value
|
||||
*/
|
||||
public static int toInteger(boolean bool, int trueValue, int falseValue) {
|
||||
public static int toInteger(final boolean bool, final int trueValue, final int falseValue) {
|
||||
return bool ? trueValue : falseValue;
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ public class BooleanUtils {
|
|||
* @param nullValue the value to return if {@code null}
|
||||
* @return the appropriate value
|
||||
*/
|
||||
public static int toInteger(Boolean bool, int trueValue, int falseValue, int nullValue) {
|
||||
public static int toInteger(final Boolean bool, final int trueValue, final int falseValue, final int nullValue) {
|
||||
if (bool == null) {
|
||||
return nullValue;
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ public class BooleanUtils {
|
|||
* @param falseValue the value to return if {@code false}, may be {@code null}
|
||||
* @return the appropriate value
|
||||
*/
|
||||
public static Integer toIntegerObject(boolean bool, Integer trueValue, Integer falseValue) {
|
||||
public static Integer toIntegerObject(final boolean bool, final Integer trueValue, final Integer falseValue) {
|
||||
return bool ? trueValue : falseValue;
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ public class BooleanUtils {
|
|||
* @param nullValue the value to return if {@code null}, may be {@code null}
|
||||
* @return the appropriate value
|
||||
*/
|
||||
public static Integer toIntegerObject(Boolean bool, Integer trueValue, Integer falseValue, Integer nullValue) {
|
||||
public static Integer toIntegerObject(final Boolean bool, final Integer trueValue, final Integer falseValue, final Integer nullValue) {
|
||||
if (bool == null) {
|
||||
return nullValue;
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ public class BooleanUtils {
|
|||
* @param str the String to check
|
||||
* @return the Boolean value of the string, {@code null} if no match or {@code null} input
|
||||
*/
|
||||
public static Boolean toBooleanObject(String str) {
|
||||
public static Boolean toBooleanObject(final String str) {
|
||||
// Previously used equalsIgnoreCase, which was fast for interned 'true'.
|
||||
// Non interned 'true' matched 15 times slower.
|
||||
//
|
||||
|
@ -642,7 +642,7 @@ public class BooleanUtils {
|
|||
* or if {@code null} input and {@code nullString} is {@code null}
|
||||
* @throws IllegalArgumentException if the String doesn't match
|
||||
*/
|
||||
public static Boolean toBooleanObject(String str, String trueString, String falseString, String nullString) {
|
||||
public static Boolean toBooleanObject(final String str, final String trueString, final String falseString, final String nullString) {
|
||||
if (str == null) {
|
||||
if (trueString == null) {
|
||||
return Boolean.TRUE;
|
||||
|
@ -691,7 +691,7 @@ public class BooleanUtils {
|
|||
* @param str the String to check
|
||||
* @return the boolean value of the string, {@code false} if no match or the String is null
|
||||
*/
|
||||
public static boolean toBoolean(String str) {
|
||||
public static boolean toBoolean(final String str) {
|
||||
return toBooleanObject(str) == Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
@ -709,7 +709,7 @@ public class BooleanUtils {
|
|||
* @return the boolean value of the string
|
||||
* @throws IllegalArgumentException if the String doesn't match
|
||||
*/
|
||||
public static boolean toBoolean(String str, String trueString, String falseString) {
|
||||
public static boolean toBoolean(final String str, final String trueString, final String falseString) {
|
||||
if (str == trueString) {
|
||||
return true;
|
||||
} else if (str == falseString) {
|
||||
|
@ -740,7 +740,7 @@ public class BooleanUtils {
|
|||
* @param bool the Boolean to check
|
||||
* @return {@code 'true'}, {@code 'false'}, or {@code null}
|
||||
*/
|
||||
public static String toStringTrueFalse(Boolean bool) {
|
||||
public static String toStringTrueFalse(final Boolean bool) {
|
||||
return toString(bool, "true", "false", null);
|
||||
}
|
||||
|
||||
|
@ -757,7 +757,7 @@ public class BooleanUtils {
|
|||
* @param bool the Boolean to check
|
||||
* @return {@code 'on'}, {@code 'off'}, or {@code null}
|
||||
*/
|
||||
public static String toStringOnOff(Boolean bool) {
|
||||
public static String toStringOnOff(final Boolean bool) {
|
||||
return toString(bool, "on", "off", null);
|
||||
}
|
||||
|
||||
|
@ -774,7 +774,7 @@ public class BooleanUtils {
|
|||
* @param bool the Boolean to check
|
||||
* @return {@code 'yes'}, {@code 'no'}, or {@code null}
|
||||
*/
|
||||
public static String toStringYesNo(Boolean bool) {
|
||||
public static String toStringYesNo(final Boolean bool) {
|
||||
return toString(bool, "yes", "no", null);
|
||||
}
|
||||
|
||||
|
@ -793,7 +793,7 @@ public class BooleanUtils {
|
|||
* @param nullString the String to return if {@code null}, may be {@code null}
|
||||
* @return one of the three input Strings
|
||||
*/
|
||||
public static String toString(Boolean bool, String trueString, String falseString, String nullString) {
|
||||
public static String toString(final Boolean bool, final String trueString, final String falseString, final String nullString) {
|
||||
if (bool == null) {
|
||||
return nullString;
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ public class BooleanUtils {
|
|||
* @param bool the Boolean to check
|
||||
* @return {@code 'true'}, {@code 'false'}, or {@code null}
|
||||
*/
|
||||
public static String toStringTrueFalse(boolean bool) {
|
||||
public static String toStringTrueFalse(final boolean bool) {
|
||||
return toString(bool, "true", "false");
|
||||
}
|
||||
|
||||
|
@ -830,7 +830,7 @@ public class BooleanUtils {
|
|||
* @param bool the Boolean to check
|
||||
* @return {@code 'on'}, {@code 'off'}, or {@code null}
|
||||
*/
|
||||
public static String toStringOnOff(boolean bool) {
|
||||
public static String toStringOnOff(final boolean bool) {
|
||||
return toString(bool, "on", "off");
|
||||
}
|
||||
|
||||
|
@ -846,7 +846,7 @@ public class BooleanUtils {
|
|||
* @param bool the Boolean to check
|
||||
* @return {@code 'yes'}, {@code 'no'}, or {@code null}
|
||||
*/
|
||||
public static String toStringYesNo(boolean bool) {
|
||||
public static String toStringYesNo(final boolean bool) {
|
||||
return toString(bool, "yes", "no");
|
||||
}
|
||||
|
||||
|
@ -863,7 +863,7 @@ public class BooleanUtils {
|
|||
* @param falseString the String to return if {@code false}, may be {@code null}
|
||||
* @return one of the two input Strings
|
||||
*/
|
||||
public static String toString(boolean bool, String trueString, String falseString) {
|
||||
public static String toString(final boolean bool, final String trueString, final String falseString) {
|
||||
return bool ? trueString : falseString;
|
||||
}
|
||||
|
||||
|
@ -886,7 +886,7 @@ public class BooleanUtils {
|
|||
* @throws IllegalArgumentException if {@code array} is empty.
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public static boolean and(boolean... array) {
|
||||
public static boolean and(final boolean... array) {
|
||||
// Validates input
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
|
@ -921,7 +921,7 @@ public class BooleanUtils {
|
|||
* @throws IllegalArgumentException if {@code array} contains a {@code null}
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public static Boolean and(Boolean... array) {
|
||||
public static Boolean and(final Boolean... array) {
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
}
|
||||
|
@ -954,7 +954,7 @@ public class BooleanUtils {
|
|||
* @throws IllegalArgumentException if {@code array} is empty.
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public static boolean or(boolean... array) {
|
||||
public static boolean or(final boolean... array) {
|
||||
// Validates input
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
|
@ -990,7 +990,7 @@ public class BooleanUtils {
|
|||
* @throws IllegalArgumentException if {@code array} contains a {@code null}
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public static Boolean or(Boolean... array) {
|
||||
public static Boolean or(final Boolean... array) {
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
}
|
||||
|
@ -1022,7 +1022,7 @@ public class BooleanUtils {
|
|||
* @throws IllegalArgumentException if {@code array} is {@code null}
|
||||
* @throws IllegalArgumentException if {@code array} is empty.
|
||||
*/
|
||||
public static boolean xor(boolean... array) {
|
||||
public static boolean xor(final boolean... array) {
|
||||
// Validates input
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
|
@ -1064,7 +1064,7 @@ public class BooleanUtils {
|
|||
* @throws IllegalArgumentException if {@code array} is empty.
|
||||
* @throws IllegalArgumentException if {@code array} contains a {@code null}
|
||||
*/
|
||||
public static Boolean xor(Boolean... array) {
|
||||
public static Boolean xor(final Boolean... array) {
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class CharEncoding {
|
|||
* @param name the name of the requested charset; may be either a canonical name or an alias, null returns false
|
||||
* @return {@code true} if the charset is available in the current Java virtual machine
|
||||
*/
|
||||
public static boolean isSupported(String name) {
|
||||
public static boolean isSupported(final String name) {
|
||||
if (name == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ final class CharRange implements Iterable<Character>, Serializable {
|
|||
* @param end last character, inclusive, in this range
|
||||
* @param negated true to express everything except the range
|
||||
*/
|
||||
private CharRange(char start, char end, boolean negated) {
|
||||
private CharRange(char start, char end, final boolean negated) {
|
||||
super();
|
||||
if (start > end) {
|
||||
char temp = start;
|
||||
|
@ -85,7 +85,7 @@ final class CharRange implements Iterable<Character>, Serializable {
|
|||
* @see CharRange#CharRange(char, char, boolean)
|
||||
* @since 2.5
|
||||
*/
|
||||
public static CharRange is(char ch) {
|
||||
public static CharRange is(final char ch) {
|
||||
return new CharRange(ch, ch, false);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ final class CharRange implements Iterable<Character>, Serializable {
|
|||
* @see CharRange#CharRange(char, char, boolean)
|
||||
* @since 2.5
|
||||
*/
|
||||
public static CharRange isNot(char ch) {
|
||||
public static CharRange isNot(final char ch) {
|
||||
return new CharRange(ch, ch, true);
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ final class CharRange implements Iterable<Character>, Serializable {
|
|||
* @see CharRange#CharRange(char, char, boolean)
|
||||
* @since 2.5
|
||||
*/
|
||||
public static CharRange isIn(char start, char end) {
|
||||
public static CharRange isIn(final char start, final char end) {
|
||||
return new CharRange(start, end, false);
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ final class CharRange implements Iterable<Character>, Serializable {
|
|||
* @see CharRange#CharRange(char, char, boolean)
|
||||
* @since 2.5
|
||||
*/
|
||||
public static CharRange isNotIn(char start, char end) {
|
||||
public static CharRange isNotIn(final char start, final char end) {
|
||||
return new CharRange(start, end, true);
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ final class CharRange implements Iterable<Character>, Serializable {
|
|||
* @param ch the character to check
|
||||
* @return {@code true} if this range contains the input character
|
||||
*/
|
||||
public boolean contains(char ch) {
|
||||
public boolean contains(final char ch) {
|
||||
return (ch >= start && ch <= end) != negated;
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ final class CharRange implements Iterable<Character>, Serializable {
|
|||
* @return {@code true} if this range entirely contains the input range
|
||||
* @throws IllegalArgumentException if {@code null} input
|
||||
*/
|
||||
public boolean contains(CharRange range) {
|
||||
public boolean contains(final CharRange range) {
|
||||
if (range == null) {
|
||||
throw new IllegalArgumentException("The Range must not be null");
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ final class CharRange implements Iterable<Character>, Serializable {
|
|||
* @return true if equal
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ final class CharRange implements Iterable<Character>, Serializable {
|
|||
*
|
||||
* @param r The character range
|
||||
*/
|
||||
private CharacterIterator(CharRange r) {
|
||||
private CharacterIterator(final CharRange r) {
|
||||
range = r;
|
||||
hasNext = true;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class CharSequenceUtils {
|
|||
* @throws IndexOutOfBoundsException if {@code start} is negative or if
|
||||
* {@code start} is greater than {@code length()}
|
||||
*/
|
||||
public static CharSequence subSequence(CharSequence cs, int start) {
|
||||
public static CharSequence subSequence(final CharSequence cs, final int start) {
|
||||
return cs == null ? null : cs.subSequence(start, cs.length());
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class CharSequenceUtils {
|
|||
* @param start the start index, negative starts at the string start
|
||||
* @return the index where the search char was found, -1 if not found
|
||||
*/
|
||||
static int indexOf(CharSequence cs, int searchChar, int start) {
|
||||
static int indexOf(final CharSequence cs, final int searchChar, int start) {
|
||||
if (cs instanceof String) {
|
||||
return ((String) cs).indexOf(searchChar, start);
|
||||
} else {
|
||||
|
@ -91,7 +91,7 @@ public class CharSequenceUtils {
|
|||
* @param start the start index
|
||||
* @return the index where the search sequence was found
|
||||
*/
|
||||
static int indexOf(CharSequence cs, CharSequence searchChar, int start) {
|
||||
static int indexOf(final CharSequence cs, final CharSequence searchChar, final int start) {
|
||||
return cs.toString().indexOf(searchChar.toString(), start);
|
||||
// if (cs instanceof String && searchChar instanceof String) {
|
||||
// // TODO: Do we assume searchChar is usually relatively small;
|
||||
|
@ -113,7 +113,7 @@ public class CharSequenceUtils {
|
|||
* @param start the start index, negative returns -1, beyond length starts at end
|
||||
* @return the index where the search char was found, -1 if not found
|
||||
*/
|
||||
static int lastIndexOf(CharSequence cs, int searchChar, int start) {
|
||||
static int lastIndexOf(final CharSequence cs, final int searchChar, int start) {
|
||||
if (cs instanceof String) {
|
||||
return ((String) cs).lastIndexOf(searchChar, start);
|
||||
} else {
|
||||
|
@ -141,7 +141,7 @@ public class CharSequenceUtils {
|
|||
* @param start the start index
|
||||
* @return the index where the search sequence was found
|
||||
*/
|
||||
static int lastIndexOf(CharSequence cs, CharSequence searchChar, int start) {
|
||||
static int lastIndexOf(final CharSequence cs, final CharSequence searchChar, final int start) {
|
||||
return cs.toString().lastIndexOf(searchChar.toString(), start);
|
||||
// if (cs instanceof String && searchChar instanceof String) {
|
||||
// // TODO: Do we assume searchChar is usually relatively small;
|
||||
|
@ -160,7 +160,7 @@ public class CharSequenceUtils {
|
|||
* @param cs the {@code CharSequence} to be processed
|
||||
* @return the resulting char array
|
||||
*/
|
||||
static char[] toCharArray(CharSequence cs) {
|
||||
static char[] toCharArray(final CharSequence cs) {
|
||||
if (cs instanceof String) {
|
||||
return ((String) cs).toCharArray();
|
||||
} else {
|
||||
|
@ -184,8 +184,8 @@ public class CharSequenceUtils {
|
|||
* @param length character length of the region
|
||||
* @return whether the region matched
|
||||
*/
|
||||
static boolean regionMatches(CharSequence cs, boolean ignoreCase, int thisStart,
|
||||
CharSequence substring, int start, int length) {
|
||||
static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, final int thisStart,
|
||||
final CharSequence substring, final int start, final int length) {
|
||||
if (cs instanceof String && substring instanceof String) {
|
||||
return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring, start, length);
|
||||
} else {
|
||||
|
|
|
@ -135,7 +135,7 @@ public class CharSet implements Serializable {
|
|||
* @return a CharSet instance
|
||||
* @since 2.4
|
||||
*/
|
||||
public static CharSet getInstance(String... setStrs) {
|
||||
public static CharSet getInstance(final String... setStrs) {
|
||||
if (setStrs == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ public class CharSet implements Serializable {
|
|||
* @param set Strings to merge into the initial set
|
||||
* @throws NullPointerException if set is {@code null}
|
||||
*/
|
||||
protected CharSet(String... set) {
|
||||
protected CharSet(final String... set) {
|
||||
super();
|
||||
int sz = set.length;
|
||||
for (int i = 0; i < sz; i++) {
|
||||
|
@ -170,7 +170,7 @@ public class CharSet implements Serializable {
|
|||
*
|
||||
* @param str set definition string
|
||||
*/
|
||||
protected void add(String str) {
|
||||
protected void add(final String str) {
|
||||
if (str == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ public class CharSet implements Serializable {
|
|||
* @param ch the character to check for
|
||||
* @return {@code true} if the set contains the characters
|
||||
*/
|
||||
public boolean contains(char ch) {
|
||||
public boolean contains(final char ch) {
|
||||
for (CharRange range : set) {
|
||||
if (range.contains(ch)) {
|
||||
return true;
|
||||
|
@ -243,7 +243,7 @@ public class CharSet implements Serializable {
|
|||
* @since 2.0
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class CharSetUtils {
|
|||
* @param set the character set to use for manipulation, may be null
|
||||
* @return the modified String, {@code null} if null string input
|
||||
*/
|
||||
public static String squeeze(String str, String... set) {
|
||||
public static String squeeze(final String str, final String... set) {
|
||||
if (StringUtils.isEmpty(str) || deepEmpty(set)) {
|
||||
return str;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class CharSetUtils {
|
|||
* @param set String[] set of characters to count, may be null
|
||||
* @return the character count, zero if null string input
|
||||
*/
|
||||
public static int count(String str, String... set) {
|
||||
public static int count(final String str, final String... set) {
|
||||
if (StringUtils.isEmpty(str) || deepEmpty(set)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class CharSetUtils {
|
|||
* @return the modified String, {@code null} if null string input
|
||||
* @since 2.0
|
||||
*/
|
||||
public static String keep(String str, String... set) {
|
||||
public static String keep(final String str, final String... set) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ public class CharSetUtils {
|
|||
* @param set String[] set of characters to delete, may be null
|
||||
* @return the modified String, {@code null} if null string input
|
||||
*/
|
||||
public static String delete(String str, String... set) {
|
||||
public static String delete(final String str, final String... set) {
|
||||
if (StringUtils.isEmpty(str) || deepEmpty(set)) {
|
||||
return str;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class CharSetUtils {
|
|||
* @param expect whether to evaluate on match, or non-match
|
||||
* @return the modified String, not null
|
||||
*/
|
||||
private static String modify(String str, String[] set, boolean expect) {
|
||||
private static String modify(final String str, final String[] set, final boolean expect) {
|
||||
CharSet chars = CharSet.getInstance(set);
|
||||
StringBuilder buffer = new StringBuilder(str.length());
|
||||
char[] chrs = str.toCharArray();
|
||||
|
@ -204,7 +204,7 @@ public class CharSetUtils {
|
|||
* @param strings String[] whose elements are being checked for emptiness
|
||||
* @return whether or not the String is empty
|
||||
*/
|
||||
private static boolean deepEmpty(String[] strings) {
|
||||
private static boolean deepEmpty(final String[] strings) {
|
||||
if (strings != null) {
|
||||
for (String s : strings) {
|
||||
if (StringUtils.isNotEmpty(s)) {
|
||||
|
|
|
@ -84,7 +84,7 @@ public class CharUtils {
|
|||
* @return a Character of the specified character
|
||||
*/
|
||||
@Deprecated
|
||||
public static Character toCharacterObject(char ch) {
|
||||
public static Character toCharacterObject(final char ch) {
|
||||
return Character.valueOf(ch);
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class CharUtils {
|
|||
* @param str the character to convert
|
||||
* @return the Character value of the first letter of the String
|
||||
*/
|
||||
public static Character toCharacterObject(String str) {
|
||||
public static Character toCharacterObject(final String str) {
|
||||
if (StringUtils.isEmpty(str)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class CharUtils {
|
|||
* @return the char value of the Character
|
||||
* @throws IllegalArgumentException if the Character is null
|
||||
*/
|
||||
public static char toChar(Character ch) {
|
||||
public static char toChar(final Character ch) {
|
||||
if (ch == null) {
|
||||
throw new IllegalArgumentException("The Character must not be null");
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class CharUtils {
|
|||
* @param defaultValue the value to use if the Character is null
|
||||
* @return the char value of the Character or the default if null
|
||||
*/
|
||||
public static char toChar(Character ch, char defaultValue) {
|
||||
public static char toChar(final Character ch, final char defaultValue) {
|
||||
if (ch == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ public class CharUtils {
|
|||
* @return the char value of the first letter of the String
|
||||
* @throws IllegalArgumentException if the String is empty
|
||||
*/
|
||||
public static char toChar(String str) {
|
||||
public static char toChar(final String str) {
|
||||
if (StringUtils.isEmpty(str)) {
|
||||
throw new IllegalArgumentException("The String must not be empty");
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ public class CharUtils {
|
|||
* @param defaultValue the value to use if the Character is null
|
||||
* @return the char value of the first letter of the String or the default if null
|
||||
*/
|
||||
public static char toChar(String str, char defaultValue) {
|
||||
public static char toChar(final String str, final char defaultValue) {
|
||||
if (StringUtils.isEmpty(str)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ public class CharUtils {
|
|||
* @return the int value of the character
|
||||
* @throws IllegalArgumentException if the character is not ASCII numeric
|
||||
*/
|
||||
public static int toIntValue(char ch) {
|
||||
public static int toIntValue(final char ch) {
|
||||
if (isAsciiNumeric(ch) == false) {
|
||||
throw new IllegalArgumentException("The character " + ch + " is not in the range '0' - '9'");
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ public class CharUtils {
|
|||
* @param defaultValue the default value to use if the character is not numeric
|
||||
* @return the int value of the character
|
||||
*/
|
||||
public static int toIntValue(char ch, int defaultValue) {
|
||||
public static int toIntValue(final char ch, final int defaultValue) {
|
||||
if (isAsciiNumeric(ch) == false) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ public class CharUtils {
|
|||
* @return the int value of the character
|
||||
* @throws IllegalArgumentException if the Character is not ASCII numeric or is null
|
||||
*/
|
||||
public static int toIntValue(Character ch) {
|
||||
public static int toIntValue(final Character ch) {
|
||||
if (ch == null) {
|
||||
throw new IllegalArgumentException("The character must not be null");
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ public class CharUtils {
|
|||
* @param defaultValue the default value to use if the character is not numeric
|
||||
* @return the int value of the character
|
||||
*/
|
||||
public static int toIntValue(Character ch, int defaultValue) {
|
||||
public static int toIntValue(final Character ch, final int defaultValue) {
|
||||
if (ch == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ public class CharUtils {
|
|||
* @param ch the character to convert
|
||||
* @return a String containing the one specified character
|
||||
*/
|
||||
public static String toString(char ch) {
|
||||
public static String toString(final char ch) {
|
||||
if (ch < 128) {
|
||||
return CHAR_STRING_ARRAY[ch];
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ public class CharUtils {
|
|||
* @param ch the character to convert
|
||||
* @return a String containing the one specified character
|
||||
*/
|
||||
public static String toString(Character ch) {
|
||||
public static String toString(final Character ch) {
|
||||
if (ch == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ public class CharUtils {
|
|||
* @param ch the character to convert
|
||||
* @return the escaped Unicode string
|
||||
*/
|
||||
public static String unicodeEscaped(char ch) {
|
||||
public static String unicodeEscaped(final char ch) {
|
||||
if (ch < 0x10) {
|
||||
return "\\u000" + Integer.toHexString(ch);
|
||||
} else if (ch < 0x100) {
|
||||
|
@ -376,7 +376,7 @@ public class CharUtils {
|
|||
* @param ch the character to convert, may be null
|
||||
* @return the escaped Unicode string, null if null input
|
||||
*/
|
||||
public static String unicodeEscaped(Character ch) {
|
||||
public static String unicodeEscaped(final Character ch) {
|
||||
if (ch == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ public class CharUtils {
|
|||
* @param ch the character to check
|
||||
* @return true if less than 128
|
||||
*/
|
||||
public static boolean isAscii(char ch) {
|
||||
public static boolean isAscii(final char ch) {
|
||||
return ch < 128;
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ public class CharUtils {
|
|||
* @param ch the character to check
|
||||
* @return true if between 32 and 126 inclusive
|
||||
*/
|
||||
public static boolean isAsciiPrintable(char ch) {
|
||||
public static boolean isAsciiPrintable(final char ch) {
|
||||
return ch >= 32 && ch < 127;
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,7 @@ public class CharUtils {
|
|||
* @param ch the character to check
|
||||
* @return true if less than 32 or equals 127
|
||||
*/
|
||||
public static boolean isAsciiControl(char ch) {
|
||||
public static boolean isAsciiControl(final char ch) {
|
||||
return ch < 32 || ch == 127;
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ public class CharUtils {
|
|||
* @param ch the character to check
|
||||
* @return true if between 65 and 90 or 97 and 122 inclusive
|
||||
*/
|
||||
public static boolean isAsciiAlpha(char ch) {
|
||||
public static boolean isAsciiAlpha(final char ch) {
|
||||
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
|
||||
}
|
||||
|
||||
|
@ -475,7 +475,7 @@ public class CharUtils {
|
|||
* @param ch the character to check
|
||||
* @return true if between 65 and 90 inclusive
|
||||
*/
|
||||
public static boolean isAsciiAlphaUpper(char ch) {
|
||||
public static boolean isAsciiAlphaUpper(final char ch) {
|
||||
return ch >= 'A' && ch <= 'Z';
|
||||
}
|
||||
|
||||
|
@ -494,7 +494,7 @@ public class CharUtils {
|
|||
* @param ch the character to check
|
||||
* @return true if between 97 and 122 inclusive
|
||||
*/
|
||||
public static boolean isAsciiAlphaLower(char ch) {
|
||||
public static boolean isAsciiAlphaLower(final char ch) {
|
||||
return ch >= 'a' && ch <= 'z';
|
||||
}
|
||||
|
||||
|
@ -513,7 +513,7 @@ public class CharUtils {
|
|||
* @param ch the character to check
|
||||
* @return true if between 48 and 57 inclusive
|
||||
*/
|
||||
public static boolean isAsciiNumeric(char ch) {
|
||||
public static boolean isAsciiNumeric(final char ch) {
|
||||
return ch >= '0' && ch <= '9';
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ public class CharUtils {
|
|||
* @param ch the character to check
|
||||
* @return true if between 48 and 57 or 65 and 90 or 97 and 122 inclusive
|
||||
*/
|
||||
public static boolean isAsciiAlphanumeric(char ch) {
|
||||
public static boolean isAsciiAlphanumeric(final char ch) {
|
||||
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9');
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public class ClassUtils {
|
|||
* @param primitive Canonical name of primitive type
|
||||
* @param abbreviation Corresponding abbreviation of primitive type
|
||||
*/
|
||||
private static void addAbbreviation(String primitive, String abbreviation) {
|
||||
private static void addAbbreviation(final String primitive, final String abbreviation) {
|
||||
abbreviationMap.put(primitive, abbreviation);
|
||||
reverseAbbreviationMap.put(abbreviation, primitive);
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public class ClassUtils {
|
|||
* @param valueIfNull the value to return if null
|
||||
* @return the class name of the object without the package name, or the null value
|
||||
*/
|
||||
public static String getShortClassName(Object object, String valueIfNull) {
|
||||
public static String getShortClassName(final Object object, final String valueIfNull) {
|
||||
if (object == null) {
|
||||
return valueIfNull;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ public class ClassUtils {
|
|||
* @param cls the class to get the short name for.
|
||||
* @return the class name without the package name or an empty string
|
||||
*/
|
||||
public static String getShortClassName(Class<?> cls) {
|
||||
public static String getShortClassName(final Class<?> cls) {
|
||||
if (cls == null) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class ClassUtils {
|
|||
* @since 3.0
|
||||
* @see Class#getSimpleName()
|
||||
*/
|
||||
public static String getSimpleName(Class<?> cls) {
|
||||
public static String getSimpleName(final Class<?> cls) {
|
||||
if (cls == null) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ public class ClassUtils {
|
|||
* @since 3.0
|
||||
* @see Class#getSimpleName()
|
||||
*/
|
||||
public static String getSimpleName(Object object, String valueIfNull) {
|
||||
public static String getSimpleName(final Object object, final String valueIfNull) {
|
||||
if (object == null) {
|
||||
return valueIfNull;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ public class ClassUtils {
|
|||
* @param valueIfNull the value to return if null
|
||||
* @return the package name of the object, or the null value
|
||||
*/
|
||||
public static String getPackageName(Object object, String valueIfNull) {
|
||||
public static String getPackageName(final Object object, final String valueIfNull) {
|
||||
if (object == null) {
|
||||
return valueIfNull;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public class ClassUtils {
|
|||
* @param cls the class to get the package name for, may be {@code null}.
|
||||
* @return the package name or an empty string
|
||||
*/
|
||||
public static String getPackageName(Class<?> cls) {
|
||||
public static String getPackageName(final Class<?> cls) {
|
||||
if (cls == null) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ public class ClassUtils {
|
|||
* @return the {@code List} of superclasses in order going up from this one
|
||||
* {@code null} if null input
|
||||
*/
|
||||
public static List<Class<?>> getAllSuperclasses(Class<?> cls) {
|
||||
public static List<Class<?>> getAllSuperclasses(final Class<?> cls) {
|
||||
if (cls == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ public class ClassUtils {
|
|||
* @return the {@code List} of interfaces in order,
|
||||
* {@code null} if null input
|
||||
*/
|
||||
public static List<Class<?>> getAllInterfaces(Class<?> cls) {
|
||||
public static List<Class<?>> getAllInterfaces(final Class<?> cls) {
|
||||
if (cls == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ public class ClassUtils {
|
|||
* @param cls the class to look up, may be {@code null}
|
||||
* @param interfacesFound the {@code Set} of interfaces for the class
|
||||
*/
|
||||
private static void getAllInterfaces(Class<?> cls, HashSet<Class<?>> interfacesFound) {
|
||||
private static void getAllInterfaces(Class<?> cls, final HashSet<Class<?>> interfacesFound) {
|
||||
while (cls != null) {
|
||||
Class<?>[] interfaces = cls.getInterfaces();
|
||||
|
||||
|
@ -386,7 +386,7 @@ public class ClassUtils {
|
|||
* {@code null} if null input
|
||||
* @throws ClassCastException if classNames contains a non String entry
|
||||
*/
|
||||
public static List<Class<?>> convertClassNamesToClasses(List<String> classNames) {
|
||||
public static List<Class<?>> convertClassNamesToClasses(final List<String> classNames) {
|
||||
if (classNames == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ public class ClassUtils {
|
|||
* {@code null} if null input
|
||||
* @throws ClassCastException if {@code classes} contains a non-{@code Class} entry
|
||||
*/
|
||||
public static List<String> convertClassesToClassNames(List<Class<?>> classes) {
|
||||
public static List<String> convertClassesToClassNames(final List<Class<?>> classes) {
|
||||
if (classes == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ public class ClassUtils {
|
|||
* @param toClassArray the array of Classes to try to assign into, may be {@code null}
|
||||
* @return {@code true} if assignment possible
|
||||
*/
|
||||
public static boolean isAssignable(Class<?>[] classArray, Class<?>... toClassArray) {
|
||||
public static boolean isAssignable(final Class<?>[] classArray, final Class<?>... toClassArray) {
|
||||
return isAssignable(classArray, toClassArray, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5));
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ public class ClassUtils {
|
|||
* @param autoboxing whether to use implicit autoboxing/unboxing between primitives and wrappers
|
||||
* @return {@code true} if assignment possible
|
||||
*/
|
||||
public static boolean isAssignable(Class<?>[] classArray, Class<?>[] toClassArray, boolean autoboxing) {
|
||||
public static boolean isAssignable(Class<?>[] classArray, Class<?>[] toClassArray, final boolean autoboxing) {
|
||||
if (ArrayUtils.isSameLength(classArray, toClassArray) == false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ public class ClassUtils {
|
|||
* {@link Short}, {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
|
||||
* @since 3.1
|
||||
*/
|
||||
public static boolean isPrimitiveOrWrapper(Class<?> type) {
|
||||
public static boolean isPrimitiveOrWrapper(final Class<?> type) {
|
||||
if (type == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ public class ClassUtils {
|
|||
* {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
|
||||
* @since 3.1
|
||||
*/
|
||||
public static boolean isPrimitiveWrapper(Class<?> type) {
|
||||
public static boolean isPrimitiveWrapper(final Class<?> type) {
|
||||
return wrapperPrimitiveMap.containsKey(type);
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ public class ClassUtils {
|
|||
* @param toClass the Class to try to assign into, returns false if null
|
||||
* @return {@code true} if assignment possible
|
||||
*/
|
||||
public static boolean isAssignable(Class<?> cls, Class<?> toClass) {
|
||||
public static boolean isAssignable(final Class<?> cls, final Class<?> toClass) {
|
||||
return isAssignable(cls, toClass, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5));
|
||||
}
|
||||
|
||||
|
@ -613,7 +613,7 @@ public class ClassUtils {
|
|||
* @param autoboxing whether to use implicit autoboxing/unboxing between primitives and wrappers
|
||||
* @return {@code true} if assignment possible
|
||||
*/
|
||||
public static boolean isAssignable(Class<?> cls, Class<?> toClass, boolean autoboxing) {
|
||||
public static boolean isAssignable(Class<?> cls, final Class<?> toClass, final boolean autoboxing) {
|
||||
if (toClass == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ public class ClassUtils {
|
|||
* {@code cls} is not a primitive. {@code null} if null input.
|
||||
* @since 2.1
|
||||
*/
|
||||
public static Class<?> primitiveToWrapper(Class<?> cls) {
|
||||
public static Class<?> primitiveToWrapper(final Class<?> cls) {
|
||||
Class<?> convertedClass = cls;
|
||||
if (cls != null && cls.isPrimitive()) {
|
||||
convertedClass = primitiveWrapperMap.get(cls);
|
||||
|
@ -716,7 +716,7 @@ public class ClassUtils {
|
|||
* Empty array if an empty array passed in.
|
||||
* @since 2.1
|
||||
*/
|
||||
public static Class<?>[] primitivesToWrappers(Class<?>... classes) {
|
||||
public static Class<?>[] primitivesToWrappers(final Class<?>... classes) {
|
||||
if (classes == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ public class ClassUtils {
|
|||
* @see #primitiveToWrapper(Class)
|
||||
* @since 2.4
|
||||
*/
|
||||
public static Class<?> wrapperToPrimitive(Class<?> cls) {
|
||||
public static Class<?> wrapperToPrimitive(final Class<?> cls) {
|
||||
return wrapperPrimitiveMap.get(cls);
|
||||
}
|
||||
|
||||
|
@ -766,7 +766,7 @@ public class ClassUtils {
|
|||
* @see #wrapperToPrimitive(Class)
|
||||
* @since 2.4
|
||||
*/
|
||||
public static Class<?>[] wrappersToPrimitives(Class<?>... classes) {
|
||||
public static Class<?>[] wrappersToPrimitives(final Class<?>... classes) {
|
||||
if (classes == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ public class ClassUtils {
|
|||
* @return {@code true} if the class is an inner or static nested class,
|
||||
* false if not or {@code null}
|
||||
*/
|
||||
public static boolean isInnerClass(Class<?> cls) {
|
||||
public static boolean isInnerClass(final Class<?> cls) {
|
||||
return cls != null && cls.getEnclosingClass() != null;
|
||||
}
|
||||
|
||||
|
@ -810,7 +810,7 @@ public class ClassUtils {
|
|||
* @throws ClassNotFoundException if the class is not found
|
||||
*/
|
||||
public static Class<?> getClass(
|
||||
ClassLoader classLoader, String className, boolean initialize) throws ClassNotFoundException {
|
||||
final ClassLoader classLoader, final String className, final boolean initialize) throws ClassNotFoundException {
|
||||
try {
|
||||
Class<?> clazz;
|
||||
if (abbreviationMap.containsKey(className)) {
|
||||
|
@ -850,7 +850,7 @@ public class ClassUtils {
|
|||
* @return the class represented by {@code className} using the {@code classLoader}
|
||||
* @throws ClassNotFoundException if the class is not found
|
||||
*/
|
||||
public static Class<?> getClass(ClassLoader classLoader, String className) throws ClassNotFoundException {
|
||||
public static Class<?> getClass(final ClassLoader classLoader, final String className) throws ClassNotFoundException {
|
||||
return getClass(classLoader, className, true);
|
||||
}
|
||||
|
||||
|
@ -865,7 +865,7 @@ public class ClassUtils {
|
|||
* @return the class represented by {@code className} using the current thread's context class loader
|
||||
* @throws ClassNotFoundException if the class is not found
|
||||
*/
|
||||
public static Class<?> getClass(String className) throws ClassNotFoundException {
|
||||
public static Class<?> getClass(final String className) throws ClassNotFoundException {
|
||||
return getClass(className, true);
|
||||
}
|
||||
|
||||
|
@ -880,7 +880,7 @@ public class ClassUtils {
|
|||
* @return the class represented by {@code className} using the current thread's context class loader
|
||||
* @throws ClassNotFoundException if the class is not found
|
||||
*/
|
||||
public static Class<?> getClass(String className, boolean initialize) throws ClassNotFoundException {
|
||||
public static Class<?> getClass(final String className, final boolean initialize) throws ClassNotFoundException {
|
||||
ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
|
||||
ClassLoader loader = contextCL == null ? ClassUtils.class.getClassLoader() : contextCL;
|
||||
return getClass(loader, className, initialize);
|
||||
|
@ -909,7 +909,7 @@ public class ClassUtils {
|
|||
* @throws NoSuchMethodException if the method is not found in the given class
|
||||
* or if the metothod doen't conform with the requirements
|
||||
*/
|
||||
public static Method getPublicMethod(Class<?> cls, String methodName, Class<?>... parameterTypes)
|
||||
public static Method getPublicMethod(final Class<?> cls, final String methodName, final Class<?>... parameterTypes)
|
||||
throws SecurityException, NoSuchMethodException {
|
||||
|
||||
Method declaredMethod = cls.getMethod(methodName, parameterTypes);
|
||||
|
@ -978,7 +978,7 @@ public class ClassUtils {
|
|||
* @return a {@code Class} array, {@code null} if null array input
|
||||
* @since 2.4
|
||||
*/
|
||||
public static Class<?>[] toClass(Object... array) {
|
||||
public static Class<?>[] toClass(final Object... array) {
|
||||
if (array == null) {
|
||||
return null;
|
||||
} else if (array.length == 0) {
|
||||
|
@ -1001,7 +1001,7 @@ public class ClassUtils {
|
|||
* @return the canonical name of the object without the package name, or the null value
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String getShortCanonicalName(Object object, String valueIfNull) {
|
||||
public static String getShortCanonicalName(final Object object, final String valueIfNull) {
|
||||
if (object == null) {
|
||||
return valueIfNull;
|
||||
}
|
||||
|
@ -1015,7 +1015,7 @@ public class ClassUtils {
|
|||
* @return the canonical name without the package name or an empty string
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String getShortCanonicalName(Class<?> cls) {
|
||||
public static String getShortCanonicalName(final Class<?> cls) {
|
||||
if (cls == null) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
@ -1031,7 +1031,7 @@ public class ClassUtils {
|
|||
* @return the canonical name of the class without the package name or an empty string
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String getShortCanonicalName(String canonicalName) {
|
||||
public static String getShortCanonicalName(final String canonicalName) {
|
||||
return ClassUtils.getShortClassName(getCanonicalName(canonicalName));
|
||||
}
|
||||
|
||||
|
@ -1045,7 +1045,7 @@ public class ClassUtils {
|
|||
* @return the package name of the object, or the null value
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String getPackageCanonicalName(Object object, String valueIfNull) {
|
||||
public static String getPackageCanonicalName(final Object object, final String valueIfNull) {
|
||||
if (object == null) {
|
||||
return valueIfNull;
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ public class ClassUtils {
|
|||
* @return the package name or an empty string
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String getPackageCanonicalName(Class<?> cls) {
|
||||
public static String getPackageCanonicalName(final Class<?> cls) {
|
||||
if (cls == null) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
@ -1076,7 +1076,7 @@ public class ClassUtils {
|
|||
* @return the package name or an empty string
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String getPackageCanonicalName(String canonicalName) {
|
||||
public static String getPackageCanonicalName(final String canonicalName) {
|
||||
return ClassUtils.getPackageName(getCanonicalName(canonicalName));
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public class Conversion {
|
|||
* @return an int equals to {@code hexDigit}
|
||||
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
|
||||
*/
|
||||
public static int hexDigitToInt(char hexDigit) {
|
||||
public static int hexDigitToInt(final char hexDigit) {
|
||||
final int digit = Character.digit(hexDigit, 16);
|
||||
if (digit < 0) {
|
||||
throw new IllegalArgumentException("Cannot interpret '"
|
||||
|
@ -97,7 +97,7 @@ public class Conversion {
|
|||
* @return an int equals to {@code hexDigit}
|
||||
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
|
||||
*/
|
||||
public static int hexDigitMsb0ToInt(char hexDigit) {
|
||||
public static int hexDigitMsb0ToInt(final char hexDigit) {
|
||||
switch (hexDigit) {
|
||||
case '0':
|
||||
return 0x0;
|
||||
|
@ -157,7 +157,7 @@ public class Conversion {
|
|||
* @return a boolean array with the binary representation of {@code hexDigit}
|
||||
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
|
||||
*/
|
||||
public static boolean[] hexDigitToBinary(char hexDigit) {
|
||||
public static boolean[] hexDigitToBinary(final char hexDigit) {
|
||||
switch (hexDigit) {
|
||||
case '0':
|
||||
return new boolean[]{false, false, false, false};
|
||||
|
@ -217,7 +217,7 @@ public class Conversion {
|
|||
* @return a boolean array with the binary representation of {@code hexDigit}
|
||||
* @throws IllegalArgumentException if {@code hexDigit} is not a hexadecimal digit
|
||||
*/
|
||||
public static boolean[] hexDigitMsb0ToBinary(char hexDigit) {
|
||||
public static boolean[] hexDigitMsb0ToBinary(final char hexDigit) {
|
||||
switch (hexDigit) {
|
||||
case '0':
|
||||
return new boolean[]{false, false, false, false};
|
||||
|
@ -278,7 +278,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code src} is empty
|
||||
* @throws NullPointerException if {@code src} is {@code null}
|
||||
*/
|
||||
public static char binaryToHexDigit(boolean[] src) {
|
||||
public static char binaryToHexDigit(final boolean[] src) {
|
||||
return binaryToHexDigit(src, 0);
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code src} is empty
|
||||
* @throws NullPointerException if {@code src} is {@code null}
|
||||
*/
|
||||
public static char binaryToHexDigit(boolean[] src, int srcPos) {
|
||||
public static char binaryToHexDigit(final boolean[] src, final int srcPos) {
|
||||
if (src.length == 0) {
|
||||
throw new IllegalArgumentException("Cannot convert an empty array.");
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ public class Conversion {
|
|||
* {@code src.length > 8}
|
||||
* @throws NullPointerException if {@code src} is {@code null}
|
||||
*/
|
||||
public static char binaryToHexDigitMsb0_4bits(boolean[] src) {
|
||||
public static char binaryToHexDigitMsb0_4bits(final boolean[] src) {
|
||||
return binaryToHexDigitMsb0_4bits(src, 0);
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ public class Conversion {
|
|||
* {@code src.length - srcPos < 4}
|
||||
* @throws NullPointerException if {@code src} is {@code null}
|
||||
*/
|
||||
public static char binaryToHexDigitMsb0_4bits(boolean[] src, int srcPos) {
|
||||
public static char binaryToHexDigitMsb0_4bits(final boolean[] src, final int srcPos) {
|
||||
if (src.length > 8) {
|
||||
throw new IllegalArgumentException("src.length>8: src.length=" + src.length);
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code src} is empty
|
||||
* @throws NullPointerException if {@code src} is {@code null}
|
||||
*/
|
||||
public static char binaryBeMsb0ToHexDigit(boolean[] src) {
|
||||
public static char binaryBeMsb0ToHexDigit(final boolean[] src) {
|
||||
return binaryBeMsb0ToHexDigit(src, 0);
|
||||
}
|
||||
|
||||
|
@ -599,7 +599,7 @@ public class Conversion {
|
|||
* @return a hexadecimal digit representing the 4 lsb of {@code nibble}
|
||||
* @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}
|
||||
*/
|
||||
public static char intToHexDigit(int nibble) {
|
||||
public static char intToHexDigit(final int nibble) {
|
||||
char c = Character.forDigit(nibble, 16);
|
||||
if (c == Character.MIN_VALUE) {
|
||||
throw new IllegalArgumentException("nibble value not between 0 and 15: " + nibble);
|
||||
|
@ -625,7 +625,7 @@ public class Conversion {
|
|||
* @return a hexadecimal digit representing the 4 lsb of {@code nibble}
|
||||
* @throws IllegalArgumentException if {@code nibble < 0} or {@code nibble > 15}
|
||||
*/
|
||||
public static char intToHexDigitMsb0(int nibble) {
|
||||
public static char intToHexDigitMsb0(final int nibble) {
|
||||
switch (nibble) {
|
||||
case 0x0:
|
||||
return '0';
|
||||
|
@ -681,7 +681,7 @@ public class Conversion {
|
|||
* @throws NullPointerException if {@code src} is {@code null}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nInts > src.length}
|
||||
*/
|
||||
public static long intArrayToLong(int[] src, int srcPos, long dstInit, int dstPos, int nInts) {
|
||||
public static long intArrayToLong(final int[] src, final int srcPos, final long dstInit, final int dstPos, final int nInts) {
|
||||
if ((src.length == 0 && srcPos == 0) || 0 == nInts) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -717,8 +717,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nShorts-1)*16+dstPos >= 64}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nShorts > src.length}
|
||||
*/
|
||||
public static long shortArrayToLong(short[] src, int srcPos, long dstInit, int dstPos,
|
||||
int nShorts) {
|
||||
public static long shortArrayToLong(final short[] src, final int srcPos, final long dstInit, final int dstPos,
|
||||
final int nShorts) {
|
||||
if ((src.length == 0 && srcPos == 0) || 0 == nShorts) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -754,8 +754,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nShorts-1)*16+dstPos >= 32}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nShorts > src.length}
|
||||
*/
|
||||
public static int shortArrayToInt(short[] src, int srcPos, int dstInit, int dstPos,
|
||||
int nShorts) {
|
||||
public static int shortArrayToInt(final short[] src, final int srcPos, final int dstInit, final int dstPos,
|
||||
final int nShorts) {
|
||||
if ((src.length == 0 && srcPos == 0) || 0 == nShorts) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -791,8 +791,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 64}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}
|
||||
*/
|
||||
public static long byteArrayToLong(byte[] src, int srcPos, long dstInit, int dstPos,
|
||||
int nBytes) {
|
||||
public static long byteArrayToLong(final byte[] src, final int srcPos, final long dstInit, final int dstPos,
|
||||
final int nBytes) {
|
||||
if ((src.length == 0 && srcPos == 0) || 0 == nBytes) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -828,7 +828,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 32}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}
|
||||
*/
|
||||
public static int byteArrayToInt(byte[] src, int srcPos, int dstInit, int dstPos, int nBytes) {
|
||||
public static int byteArrayToInt(final byte[] src, final int srcPos, final int dstInit, final int dstPos, final int nBytes) {
|
||||
if ((src.length == 0 && srcPos == 0) || 0 == nBytes) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -864,8 +864,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nBytes-1)*8+dstPos >= 16}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBytes > src.length}
|
||||
*/
|
||||
public static short byteArrayToShort(byte[] src, int srcPos, short dstInit, int dstPos,
|
||||
int nBytes) {
|
||||
public static short byteArrayToShort(final byte[] src, final int srcPos, final short dstInit, final int dstPos,
|
||||
final int nBytes) {
|
||||
if ((src.length == 0 && srcPos == 0) || 0 == nBytes) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -899,7 +899,7 @@ public class Conversion {
|
|||
* @return a long containing the selected bits
|
||||
* @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 64}
|
||||
*/
|
||||
public static long hexToLong(String src, int srcPos, long dstInit, int dstPos, int nHex) {
|
||||
public static long hexToLong(final String src, final int srcPos, final long dstInit, final int dstPos, final int nHex) {
|
||||
if (0 == nHex) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -933,7 +933,7 @@ public class Conversion {
|
|||
* @return a int containing the selected bits
|
||||
* @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 32}
|
||||
*/
|
||||
public static int hexToInt(String src, int srcPos, int dstInit, int dstPos, int nHex) {
|
||||
public static int hexToInt(final String src, final int srcPos, final int dstInit, final int dstPos, final int nHex) {
|
||||
if (0 == nHex) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ public class Conversion {
|
|||
* @return a short containing the selected bits
|
||||
* @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 16}
|
||||
*/
|
||||
public static short hexToShort(String src, int srcPos, short dstInit, int dstPos, int nHex) {
|
||||
public static short hexToShort(final String src, final int srcPos, final short dstInit, final int dstPos, final int nHex) {
|
||||
if (0 == nHex) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -1001,7 +1001,7 @@ public class Conversion {
|
|||
* @return a byte containing the selected bits
|
||||
* @throws IllegalArgumentException if {@code (nHexs-1)*4+dstPos >= 8}
|
||||
*/
|
||||
public static byte hexToByte(String src, int srcPos, byte dstInit, int dstPos, int nHex) {
|
||||
public static byte hexToByte(final String src, final int srcPos, final byte dstInit, final int dstPos, final int nHex) {
|
||||
if (0 == nHex) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -1037,8 +1037,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code nBools-1+dstPos >= 64}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
|
||||
*/
|
||||
public static long binaryToLong(boolean[] src, int srcPos, long dstInit, int dstPos,
|
||||
int nBools) {
|
||||
public static long binaryToLong(final boolean[] src, final int srcPos, final long dstInit, final int dstPos,
|
||||
final int nBools) {
|
||||
if ((src.length == 0 && srcPos == 0) || 0 == nBools) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -1074,7 +1074,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code nBools-1+dstPos >= 32}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
|
||||
*/
|
||||
public static int binaryToInt(boolean[] src, int srcPos, int dstInit, int dstPos, int nBools) {
|
||||
public static int binaryToInt(final boolean[] src, final int srcPos, final int dstInit, final int dstPos, final int nBools) {
|
||||
if ((src.length == 0 && srcPos == 0) || 0 == nBools) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -1110,8 +1110,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code nBools-1+dstPos >= 16}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
|
||||
*/
|
||||
public static short binaryToShort(boolean[] src, int srcPos, short dstInit, int dstPos,
|
||||
int nBools) {
|
||||
public static short binaryToShort(final boolean[] src, final int srcPos, final short dstInit, final int dstPos,
|
||||
final int nBools) {
|
||||
if ((src.length == 0 && srcPos == 0) || 0 == nBools) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -1147,8 +1147,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code nBools-1+dstPos >= 8}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code srcPos + nBools > src.length}
|
||||
*/
|
||||
public static byte binaryToByte(boolean[] src, int srcPos, byte dstInit, int dstPos,
|
||||
int nBools) {
|
||||
public static byte binaryToByte(final boolean[] src, final int srcPos, final byte dstInit, final int dstPos,
|
||||
final int nBools) {
|
||||
if ((src.length == 0 && srcPos == 0) || 0 == nBools) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -1183,7 +1183,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nInts-1)*32+srcPos >= 64}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nInts > dst.length}
|
||||
*/
|
||||
public static int[] longToIntArray(long src, int srcPos, int[] dst, int dstPos, int nInts) {
|
||||
public static int[] longToIntArray(final long src, final int srcPos, final int[] dst, final int dstPos, final int nInts) {
|
||||
if (0 == nInts) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1216,8 +1216,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nShorts-1)*16+srcPos >= 64}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nShorts > dst.length}
|
||||
*/
|
||||
public static short[] longToShortArray(long src, int srcPos, short[] dst, int dstPos,
|
||||
int nShorts) {
|
||||
public static short[] longToShortArray(final long src, final int srcPos, final short[] dst, final int dstPos,
|
||||
final int nShorts) {
|
||||
if (0 == nShorts) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1250,8 +1250,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nShorts-1)*16+srcPos >= 32}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nShorts > dst.length}
|
||||
*/
|
||||
public static short[] intToShortArray(int src, int srcPos, short[] dst, int dstPos,
|
||||
int nShorts) {
|
||||
public static short[] intToShortArray(final int src, final int srcPos, final short[] dst, final int dstPos,
|
||||
final int nShorts) {
|
||||
if (0 == nShorts) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1284,8 +1284,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 64}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
|
||||
*/
|
||||
public static byte[] longToByteArray(long src, int srcPos, byte[] dst, int dstPos,
|
||||
int nBytes) {
|
||||
public static byte[] longToByteArray(final long src, final int srcPos, final byte[] dst, final int dstPos,
|
||||
final int nBytes) {
|
||||
if (0 == nBytes) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1318,7 +1318,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 32}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
|
||||
*/
|
||||
public static byte[] intToByteArray(int src, int srcPos, byte[] dst, int dstPos, int nBytes) {
|
||||
public static byte[] intToByteArray(final int src, final int srcPos, final byte[] dst, final int dstPos, final int nBytes) {
|
||||
if (0 == nBytes) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1351,8 +1351,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nBytes-1)*8+srcPos >= 16}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
|
||||
*/
|
||||
public static byte[] shortToByteArray(short src, int srcPos, byte[] dst, int dstPos,
|
||||
int nBytes) {
|
||||
public static byte[] shortToByteArray(final short src, final int srcPos, final byte[] dst, final int dstPos,
|
||||
final int nBytes) {
|
||||
if (0 == nBytes) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1384,7 +1384,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 64}
|
||||
* @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
|
||||
*/
|
||||
public static String longToHex(long src, int srcPos, String dstInit, int dstPos, int nHexs) {
|
||||
public static String longToHex(final long src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
|
||||
if (0 == nHexs) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -1424,7 +1424,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 32}
|
||||
* @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
|
||||
*/
|
||||
public static String intToHex(int src, int srcPos, String dstInit, int dstPos, int nHexs) {
|
||||
public static String intToHex(final int src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
|
||||
if (0 == nHexs) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -1464,7 +1464,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 16}
|
||||
* @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
|
||||
*/
|
||||
public static String shortToHex(short src, int srcPos, String dstInit, int dstPos, int nHexs) {
|
||||
public static String shortToHex(final short src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
|
||||
if (0 == nHexs) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -1504,7 +1504,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code (nHexs-1)*4+srcPos >= 8}
|
||||
* @throws StringIndexOutOfBoundsException if {@code dst.init.length() < dstPos}
|
||||
*/
|
||||
public static String byteToHex(byte src, int srcPos, String dstInit, int dstPos, int nHexs) {
|
||||
public static String byteToHex(final byte src, final int srcPos, final String dstInit, final int dstPos, final int nHexs) {
|
||||
if (0 == nHexs) {
|
||||
return dstInit;
|
||||
}
|
||||
|
@ -1545,8 +1545,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code nBools-1+srcPos >= 64}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
|
||||
*/
|
||||
public static boolean[] longToBinary(long src, int srcPos, boolean[] dst, int dstPos,
|
||||
int nBools) {
|
||||
public static boolean[] longToBinary(final long src, final int srcPos, final boolean[] dst, final int dstPos,
|
||||
final int nBools) {
|
||||
if (0 == nBools) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1579,8 +1579,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code nBools-1+srcPos >= 32}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
|
||||
*/
|
||||
public static boolean[] intToBinary(int src, int srcPos, boolean[] dst, int dstPos,
|
||||
int nBools) {
|
||||
public static boolean[] intToBinary(final int src, final int srcPos, final boolean[] dst, final int dstPos,
|
||||
final int nBools) {
|
||||
if (0 == nBools) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1613,8 +1613,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code nBools-1+srcPos >= 16}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
|
||||
*/
|
||||
public static boolean[] shortToBinary(short src, int srcPos, boolean[] dst, int dstPos,
|
||||
int nBools) {
|
||||
public static boolean[] shortToBinary(final short src, final int srcPos, final boolean[] dst, final int dstPos,
|
||||
final int nBools) {
|
||||
if (0 == nBools) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1648,8 +1648,8 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code nBools-1+srcPos >= 8}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBools > dst.length}
|
||||
*/
|
||||
public static boolean[] byteToBinary(byte src, int srcPos, boolean[] dst, int dstPos,
|
||||
int nBools) {
|
||||
public static boolean[] byteToBinary(final byte src, final int srcPos, final boolean[] dst, final int dstPos,
|
||||
final int nBools) {
|
||||
if (0 == nBools) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1680,7 +1680,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if {@code nBytes > 16}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code dstPos + nBytes > dst.length}
|
||||
*/
|
||||
public static byte[] uuidToByteArray(UUID src, byte[] dst, int dstPos, int nBytes) {
|
||||
public static byte[] uuidToByteArray(final UUID src, final byte[] dst, final int dstPos, final int nBytes) {
|
||||
if (0 == nBytes) {
|
||||
return dst;
|
||||
}
|
||||
|
@ -1707,7 +1707,7 @@ public class Conversion {
|
|||
* @throws IllegalArgumentException if array does not contain at least 16 bytes beginning
|
||||
* with {@code srcPos}
|
||||
*/
|
||||
public static UUID byteArrayToUuid(byte[] src, int srcPos) {
|
||||
public static UUID byteArrayToUuid(final byte[] src, final int srcPos) {
|
||||
if (src.length - srcPos < 16) {
|
||||
throw new IllegalArgumentException("Need at least 16 bytes for UUID");
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class EnumUtils {
|
|||
* @param enumClass the class of the enum to query, not null
|
||||
* @return the modifiable map of enum names to enums, never null
|
||||
*/
|
||||
public static <E extends Enum<E>> Map<String, E> getEnumMap(Class<E> enumClass) {
|
||||
public static <E extends Enum<E>> Map<String, E> getEnumMap(final Class<E> enumClass) {
|
||||
Map<String, E> map = new LinkedHashMap<String, E>();
|
||||
for (E e: enumClass.getEnumConstants()) {
|
||||
map.put(e.name(), e);
|
||||
|
@ -72,7 +72,7 @@ public class EnumUtils {
|
|||
* @param enumClass the class of the enum to query, not null
|
||||
* @return the modifiable list of enums, never null
|
||||
*/
|
||||
public static <E extends Enum<E>> List<E> getEnumList(Class<E> enumClass) {
|
||||
public static <E extends Enum<E>> List<E> getEnumList(final Class<E> enumClass) {
|
||||
return new ArrayList<E>(Arrays.asList(enumClass.getEnumConstants()));
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class EnumUtils {
|
|||
* @param enumName the enum name, null returns false
|
||||
* @return true if the enum name is valid, otherwise false
|
||||
*/
|
||||
public static <E extends Enum<E>> boolean isValidEnum(Class<E> enumClass, String enumName) {
|
||||
public static <E extends Enum<E>> boolean isValidEnum(final Class<E> enumClass, final String enumName) {
|
||||
if (enumName == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class EnumUtils {
|
|||
* @param enumName the enum name, null returns null
|
||||
* @return the enum, null if not found
|
||||
*/
|
||||
public static <E extends Enum<E>> E getEnum(Class<E> enumClass, String enumName) {
|
||||
public static <E extends Enum<E>> E getEnum(final Class<E> enumClass, final String enumName) {
|
||||
if (enumName == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class EnumUtils {
|
|||
* @since 3.0.1
|
||||
* @see #generateBitVectors(Class, Iterable)
|
||||
*/
|
||||
public static <E extends Enum<E>> long generateBitVector(Class<E> enumClass, Iterable<E> values) {
|
||||
public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClass, final Iterable<E> values) {
|
||||
checkBitVectorable(enumClass);
|
||||
Validate.notNull(values);
|
||||
long total = 0;
|
||||
|
@ -166,7 +166,7 @@ public class EnumUtils {
|
|||
* @throws IllegalArgumentException if {@code enumClass} is not an enum class, or if any {@code values} {@code null}
|
||||
* @since 3.2
|
||||
*/
|
||||
public static <E extends Enum<E>> long[] generateBitVectors(Class<E> enumClass, Iterable<E> values) {
|
||||
public static <E extends Enum<E>> long[] generateBitVectors(final Class<E> enumClass, final Iterable<E> values) {
|
||||
asEnum(enumClass);
|
||||
Validate.notNull(values);
|
||||
final EnumSet<E> condensed = EnumSet.noneOf(enumClass);
|
||||
|
@ -199,7 +199,7 @@ public class EnumUtils {
|
|||
* @since 3.0.1
|
||||
* @see #generateBitVectors(Class, Iterable)
|
||||
*/
|
||||
public static <E extends Enum<E>> long generateBitVector(Class<E> enumClass, E... values) {
|
||||
public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClass, final E... values) {
|
||||
Validate.noNullElements(values);
|
||||
return generateBitVector(enumClass, Arrays.<E> asList(values));
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ public class EnumUtils {
|
|||
* @throws IllegalArgumentException if {@code enumClass} is not an enum class, or if any {@code values} {@code null}
|
||||
* @since 3.2
|
||||
*/
|
||||
public static <E extends Enum<E>> long[] generateBitVectors(Class<E> enumClass, E... values) {
|
||||
public static <E extends Enum<E>> long[] generateBitVectors(final Class<E> enumClass, final E... values) {
|
||||
asEnum(enumClass);
|
||||
Validate.noNullElements(values);
|
||||
final EnumSet<E> condensed = EnumSet.noneOf(enumClass);
|
||||
|
@ -246,7 +246,7 @@ public class EnumUtils {
|
|||
* @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public static <E extends Enum<E>> EnumSet<E> processBitVector(Class<E> enumClass, long value) {
|
||||
public static <E extends Enum<E>> EnumSet<E> processBitVector(final Class<E> enumClass, final long value) {
|
||||
checkBitVectorable(enumClass).getEnumConstants();
|
||||
return processBitVectors(enumClass, value);
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ public class EnumUtils {
|
|||
* @throws IllegalArgumentException if {@code enumClass} is not an enum class
|
||||
* @since 3.2
|
||||
*/
|
||||
public static <E extends Enum<E>> EnumSet<E> processBitVectors(Class<E> enumClass, long... values) {
|
||||
public static <E extends Enum<E>> EnumSet<E> processBitVectors(final Class<E> enumClass, long... values) {
|
||||
final EnumSet<E> results = EnumSet.noneOf(asEnum(enumClass));
|
||||
values = ArrayUtils.clone(Validate.notNull(values));
|
||||
ArrayUtils.reverse(values);
|
||||
|
@ -286,7 +286,7 @@ public class EnumUtils {
|
|||
* @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
|
||||
* @since 3.0.1
|
||||
*/
|
||||
private static <E extends Enum<E>> Class<E> checkBitVectorable(Class<E> enumClass) {
|
||||
private static <E extends Enum<E>> Class<E> checkBitVectorable(final Class<E> enumClass) {
|
||||
final E[] constants = asEnum(enumClass).getEnumConstants();
|
||||
Validate.isTrue(constants.length <= Long.SIZE, CANNOT_STORE_S_S_VALUES_IN_S_BITS, constants.length,
|
||||
enumClass.getSimpleName(), Long.SIZE);
|
||||
|
@ -303,7 +303,7 @@ public class EnumUtils {
|
|||
* @throws IllegalArgumentException if {@code enumClass} is not an enum class
|
||||
* @since 3.2
|
||||
*/
|
||||
private static <E extends Enum<E>> Class<E> asEnum(Class<E> enumClass) {
|
||||
private static <E extends Enum<E>> Class<E> asEnum(final Class<E> enumClass) {
|
||||
Validate.notNull(enumClass, ENUM_CLASS_MUST_BE_DEFINED);
|
||||
Validate.isTrue(enumClass.isEnum(), S_DOES_NOT_SEEM_TO_BE_AN_ENUM_TYPE, enumClass);
|
||||
return enumClass;
|
||||
|
|
|
@ -101,7 +101,7 @@ public enum JavaVersion {
|
|||
* @param requiredVersion the version to check against, not null
|
||||
* @return true if this version is equal to or greater than the specified version
|
||||
*/
|
||||
public boolean atLeast(JavaVersion requiredVersion) {
|
||||
public boolean atLeast(final JavaVersion requiredVersion) {
|
||||
return this.value >= requiredVersion.value;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ public class LocaleUtils {
|
|||
* @param locale the locale to start from
|
||||
* @return the unmodifiable list of Locale objects, 0 being locale, not null
|
||||
*/
|
||||
public static List<Locale> localeLookupList(Locale locale) {
|
||||
public static List<Locale> localeLookupList(final Locale locale) {
|
||||
return localeLookupList(locale, locale);
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ public class LocaleUtils {
|
|||
* @param defaultLocale the default locale to use if no other is found
|
||||
* @return the unmodifiable list of Locale objects, 0 being locale, not null
|
||||
*/
|
||||
public static List<Locale> localeLookupList(Locale locale, Locale defaultLocale) {
|
||||
public static List<Locale> localeLookupList(final Locale locale, final Locale defaultLocale) {
|
||||
List<Locale> list = new ArrayList<Locale>(4);
|
||||
if (locale != null) {
|
||||
list.add(locale);
|
||||
|
@ -235,7 +235,7 @@ public class LocaleUtils {
|
|||
* @param locale the Locale object to check if it is available
|
||||
* @return true if the locale is a known locale
|
||||
*/
|
||||
public static boolean isAvailableLocale(Locale locale) {
|
||||
public static boolean isAvailableLocale(final Locale locale) {
|
||||
return availableLocaleList().contains(locale);
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ public class LocaleUtils {
|
|||
* @param countryCode the 2 letter country code, null returns empty
|
||||
* @return an unmodifiable List of Locale objects, not null
|
||||
*/
|
||||
public static List<Locale> languagesByCountry(String countryCode) {
|
||||
public static List<Locale> languagesByCountry(final String countryCode) {
|
||||
if (countryCode == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ public class LocaleUtils {
|
|||
* @param languageCode the 2 letter language code, null returns empty
|
||||
* @return an unmodifiable List of Locale objects, not null
|
||||
*/
|
||||
public static List<Locale> countriesByLanguage(String languageCode) {
|
||||
public static List<Locale> countriesByLanguage(final String languageCode) {
|
||||
if (languageCode == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class ObjectUtils {
|
|||
* @param defaultValue the default value to return, may be {@code null}
|
||||
* @return {@code object} if it is not {@code null}, defaultValue otherwise
|
||||
*/
|
||||
public static <T> T defaultIfNull(T object, T defaultValue) {
|
||||
public static <T> T defaultIfNull(final T object, final T defaultValue) {
|
||||
return object != null ? object : defaultValue;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class ObjectUtils {
|
|||
* or {@code null} if there are no non-null values
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T> T firstNonNull(T... values) {
|
||||
public static <T> T firstNonNull(final T... values) {
|
||||
if (values != null) {
|
||||
for (T val : values) {
|
||||
if (val != null) {
|
||||
|
@ -148,7 +148,7 @@ public class ObjectUtils {
|
|||
* @param object2 the second object, may be {@code null}
|
||||
* @return {@code true} if the values of both objects are the same
|
||||
*/
|
||||
public static boolean equals(Object object1, Object object2) {
|
||||
public static boolean equals(final Object object1, final Object object2) {
|
||||
if (object1 == object2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public class ObjectUtils {
|
|||
* @param object2 the second object, may be {@code null}
|
||||
* @return {@code false} if the values of both objects are the same
|
||||
*/
|
||||
public static boolean notEqual(Object object1, Object object2) {
|
||||
public static boolean notEqual(final Object object1, final Object object2) {
|
||||
return ObjectUtils.equals(object1, object2) == false;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class ObjectUtils {
|
|||
* @return the hash code of the object, or zero if null
|
||||
* @since 2.1
|
||||
*/
|
||||
public static int hashCode(Object obj) {
|
||||
public static int hashCode(final Object obj) {
|
||||
// hashCode(Object) retained for performance, as hash code is often critical
|
||||
return obj == null ? 0 : obj.hashCode();
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class ObjectUtils {
|
|||
* @return the hash code of the objects, or zero if null
|
||||
* @since 3.0
|
||||
*/
|
||||
public static int hashCodeMulti(Object... objects) {
|
||||
public static int hashCodeMulti(final Object... objects) {
|
||||
int hash = 1;
|
||||
if (objects != null) {
|
||||
for (Object object : objects) {
|
||||
|
@ -247,7 +247,7 @@ public class ObjectUtils {
|
|||
* @return the default toString text, or {@code null} if
|
||||
* {@code null} passed in
|
||||
*/
|
||||
public static String identityToString(Object object) {
|
||||
public static String identityToString(final Object object) {
|
||||
if (object == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ public class ObjectUtils {
|
|||
* @param object the object to create a toString for
|
||||
* @since 2.4
|
||||
*/
|
||||
public static void identityToString(StringBuffer buffer, Object object) {
|
||||
public static void identityToString(final StringBuffer buffer, final Object object) {
|
||||
if (object == null) {
|
||||
throw new NullPointerException("Cannot get the toString of a null identity");
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ public class ObjectUtils {
|
|||
* @return the passed in Object's toString, or {@code ""} if {@code null} input
|
||||
* @since 2.0
|
||||
*/
|
||||
public static String toString(Object obj) {
|
||||
public static String toString(final Object obj) {
|
||||
return obj == null ? "" : obj.toString();
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ public class ObjectUtils {
|
|||
* @return the passed in Object's toString, or {@code nullStr} if {@code null} input
|
||||
* @since 2.0
|
||||
*/
|
||||
public static String toString(Object obj, String nullStr) {
|
||||
public static String toString(final Object obj, final String nullStr) {
|
||||
return obj == null ? nullStr : obj.toString();
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ public class ObjectUtils {
|
|||
* <li>If all the comparables are null, null is returned.
|
||||
* </ul>
|
||||
*/
|
||||
public static <T extends Comparable<? super T>> T min(T... values) {
|
||||
public static <T extends Comparable<? super T>> T min(final T... values) {
|
||||
T result = null;
|
||||
if (values != null) {
|
||||
for (T value : values) {
|
||||
|
@ -366,7 +366,7 @@ public class ObjectUtils {
|
|||
* <li>If all the comparables are null, null is returned.
|
||||
* </ul>
|
||||
*/
|
||||
public static <T extends Comparable<? super T>> T max(T... values) {
|
||||
public static <T extends Comparable<? super T>> T max(final T... values) {
|
||||
T result = null;
|
||||
if (values != null) {
|
||||
for (T value : values) {
|
||||
|
@ -388,7 +388,7 @@ public class ObjectUtils {
|
|||
* @return a negative value if c1 < c2, zero if c1 = c2
|
||||
* and a positive value if c1 > c2
|
||||
*/
|
||||
public static <T extends Comparable<? super T>> int compare(T c1, T c2) {
|
||||
public static <T extends Comparable<? super T>> int compare(final T c1, final T c2) {
|
||||
return compare(c1, c2, false);
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ public class ObjectUtils {
|
|||
* and a positive value if c1 > c2
|
||||
* @see java.util.Comparator#compare(Object, Object)
|
||||
*/
|
||||
public static <T extends Comparable<? super T>> int compare(T c1, T c2, boolean nullGreater) {
|
||||
public static <T extends Comparable<? super T>> int compare(final T c1, final T c2, final boolean nullGreater) {
|
||||
if (c1 == c2) {
|
||||
return 0;
|
||||
} else if (c1 == null) {
|
||||
|
@ -426,7 +426,7 @@ public class ObjectUtils {
|
|||
* @throws IllegalArgumentException if items is empty or contains {@code null} values
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public static <T extends Comparable<? super T>> T median(T... items) {
|
||||
public static <T extends Comparable<? super T>> T median(final T... items) {
|
||||
Validate.notEmpty(items);
|
||||
Validate.noNullElements(items);
|
||||
TreeSet<T> sort = new TreeSet<T>();
|
||||
|
@ -447,7 +447,7 @@ public class ObjectUtils {
|
|||
* @throws IllegalArgumentException if items is empty or contains {@code null} values
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public static <T> T median(Comparator<T> comparator, T... items) {
|
||||
public static <T> T median(final Comparator<T> comparator, final T... items) {
|
||||
Validate.notEmpty(items, "null/empty items");
|
||||
Validate.noNullElements(items);
|
||||
Validate.notNull(comparator, "null comparator");
|
||||
|
@ -468,7 +468,7 @@ public class ObjectUtils {
|
|||
* @return most populous T, {@code null} if non-unique or no items supplied
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public static <T> T mode(T... items) {
|
||||
public static <T> T mode(final T... items) {
|
||||
if (ArrayUtils.isNotEmpty(items)) {
|
||||
HashMap<T, MutableInt> occurrences = new HashMap<T, MutableInt>(items.length);
|
||||
for (T t : items) {
|
||||
|
|
|
@ -65,7 +65,7 @@ public class RandomStringUtils {
|
|||
* @param count the length of random string to create
|
||||
* @return the random string
|
||||
*/
|
||||
public static String random(int count) {
|
||||
public static String random(final int count) {
|
||||
return random(count, false, false);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class RandomStringUtils {
|
|||
* @param count the length of random string to create
|
||||
* @return the random string
|
||||
*/
|
||||
public static String randomAscii(int count) {
|
||||
public static String randomAscii(final int count) {
|
||||
return random(count, 32, 127, false, false);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class RandomStringUtils {
|
|||
* @param count the length of random string to create
|
||||
* @return the random string
|
||||
*/
|
||||
public static String randomAlphabetic(int count) {
|
||||
public static String randomAlphabetic(final int count) {
|
||||
return random(count, true, false);
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class RandomStringUtils {
|
|||
* @param count the length of random string to create
|
||||
* @return the random string
|
||||
*/
|
||||
public static String randomAlphanumeric(int count) {
|
||||
public static String randomAlphanumeric(final int count) {
|
||||
return random(count, true, true);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class RandomStringUtils {
|
|||
* @param count the length of random string to create
|
||||
* @return the random string
|
||||
*/
|
||||
public static String randomNumeric(int count) {
|
||||
public static String randomNumeric(final int count) {
|
||||
return random(count, false, true);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class RandomStringUtils {
|
|||
* numeric characters
|
||||
* @return the random string
|
||||
*/
|
||||
public static String random(int count, boolean letters, boolean numbers) {
|
||||
public static String random(final int count, final boolean letters, final boolean numbers) {
|
||||
return random(count, 0, 0, letters, numbers);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ public class RandomStringUtils {
|
|||
* numeric characters
|
||||
* @return the random string
|
||||
*/
|
||||
public static String random(int count, int start, int end, boolean letters, boolean numbers) {
|
||||
public static String random(final int count, final int start, final int end, final boolean letters, final boolean numbers) {
|
||||
return random(count, start, end, letters, numbers, null, RANDOM);
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ public class RandomStringUtils {
|
|||
* @throws ArrayIndexOutOfBoundsException if there are not
|
||||
* {@code (end - start) + 1} characters in the set array.
|
||||
*/
|
||||
public static String random(int count, int start, int end, boolean letters, boolean numbers, char... chars) {
|
||||
public static String random(final int count, final int start, final int end, final boolean letters, final boolean numbers, final char... chars) {
|
||||
return random(count, start, end, letters, numbers, chars, RANDOM);
|
||||
}
|
||||
|
||||
|
@ -220,8 +220,8 @@ public class RandomStringUtils {
|
|||
* @throws IllegalArgumentException if {@code count} < 0 or the provided chars array is empty.
|
||||
* @since 2.0
|
||||
*/
|
||||
public static String random(int count, int start, int end, boolean letters, boolean numbers,
|
||||
char[] chars, Random random) {
|
||||
public static String random(int count, int start, int end, final boolean letters, final boolean numbers,
|
||||
final char[] chars, final Random random) {
|
||||
if (count == 0) {
|
||||
return "";
|
||||
} else if (count < 0) {
|
||||
|
@ -306,7 +306,7 @@ public class RandomStringUtils {
|
|||
* @return the random string
|
||||
* @throws IllegalArgumentException if {@code count} < 0 or the string is empty.
|
||||
*/
|
||||
public static String random(int count, String chars) {
|
||||
public static String random(final int count, final String chars) {
|
||||
if (chars == null) {
|
||||
return random(count, 0, 0, false, false, null, RANDOM);
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ public class RandomStringUtils {
|
|||
* @return the random string
|
||||
* @throws IllegalArgumentException if {@code count} < 0.
|
||||
*/
|
||||
public static String random(int count, char... chars) {
|
||||
public static String random(final int count, final char... chars) {
|
||||
if (chars == null) {
|
||||
return random(count, 0, 0, false, false, null, RANDOM);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public final class Range<T> implements Serializable {
|
|||
* @throws IllegalArgumentException if the element is null
|
||||
* @throws ClassCastException if the element is not {@code Comparable}
|
||||
*/
|
||||
public static <T extends Comparable<T>> Range<T> is(T element) {
|
||||
public static <T extends Comparable<T>> Range<T> is(final T element) {
|
||||
return between(element, element, null);
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public final class Range<T> implements Serializable {
|
|||
* @throws IllegalArgumentException if the element is null
|
||||
* @throws ClassCastException if using natural ordering and the elements are not {@code Comparable}
|
||||
*/
|
||||
public static <T> Range<T> is(T element, Comparator<T> comparator) {
|
||||
public static <T> Range<T> is(final T element, final Comparator<T> comparator) {
|
||||
return between(element, element, comparator);
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ public final class Range<T> implements Serializable {
|
|||
* @throws IllegalArgumentException if either element is null
|
||||
* @throws ClassCastException if the elements are not {@code Comparable}
|
||||
*/
|
||||
public static <T extends Comparable<T>> Range<T> between(T fromInclusive, T toInclusive) {
|
||||
public static <T extends Comparable<T>> Range<T> between(final T fromInclusive, final T toInclusive) {
|
||||
return between(fromInclusive, toInclusive, null);
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public final class Range<T> implements Serializable {
|
|||
* @throws IllegalArgumentException if either element is null
|
||||
* @throws ClassCastException if using natural ordering and the elements are not {@code Comparable}
|
||||
*/
|
||||
public static <T> Range<T> between(T fromInclusive, T toInclusive, Comparator<T> comparator) {
|
||||
public static <T> Range<T> between(final T fromInclusive, final T toInclusive, final Comparator<T> comparator) {
|
||||
return new Range<T>(fromInclusive, toInclusive, comparator);
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public final class Range<T> implements Serializable {
|
|||
* @param comparator the comparator to be used, null for natural ordering
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private Range(T element1, T element2, Comparator<T> comparator) {
|
||||
private Range(final T element1, final T element2, Comparator<T> comparator) {
|
||||
if (element1 == null || element2 == null) {
|
||||
throw new IllegalArgumentException("Elements in a range must not be null: element1=" +
|
||||
element1 + ", element2=" + element2);
|
||||
|
@ -215,7 +215,7 @@ public final class Range<T> implements Serializable {
|
|||
* @param element the element to check for, null returns false
|
||||
* @return true if the specified element occurs within this range
|
||||
*/
|
||||
public boolean contains(T element) {
|
||||
public boolean contains(final T element) {
|
||||
if (element == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ public final class Range<T> implements Serializable {
|
|||
* @param element the element to check for, null returns false
|
||||
* @return true if this range is entirely after the specified element
|
||||
*/
|
||||
public boolean isAfter(T element) {
|
||||
public boolean isAfter(final T element) {
|
||||
if (element == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public final class Range<T> implements Serializable {
|
|||
* @param element the element to check for, null returns false
|
||||
* @return true if the specified element occurs within this range
|
||||
*/
|
||||
public boolean isStartedBy(T element) {
|
||||
public boolean isStartedBy(final T element) {
|
||||
if (element == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ public final class Range<T> implements Serializable {
|
|||
* @param element the element to check for, null returns false
|
||||
* @return true if the specified element occurs within this range
|
||||
*/
|
||||
public boolean isEndedBy(T element) {
|
||||
public boolean isEndedBy(final T element) {
|
||||
if (element == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ public final class Range<T> implements Serializable {
|
|||
* @param element the element to check for, null returns false
|
||||
* @return true if this range is entirely before the specified element
|
||||
*/
|
||||
public boolean isBefore(T element) {
|
||||
public boolean isBefore(final T element) {
|
||||
if (element == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public final class Range<T> implements Serializable {
|
|||
* @param element the element to check for, not null
|
||||
* @return -1, 0 or +1 depending on the element's location relative to the range
|
||||
*/
|
||||
public int elementCompareTo(T element) {
|
||||
public int elementCompareTo(final T element) {
|
||||
if (element == null) {
|
||||
// Comparable API says throw NPE on null
|
||||
throw new NullPointerException("Element is null");
|
||||
|
@ -310,7 +310,7 @@ public final class Range<T> implements Serializable {
|
|||
* @return true if this range contains the specified range
|
||||
* @throws RuntimeException if ranges cannot be compared
|
||||
*/
|
||||
public boolean containsRange(Range<T> otherRange) {
|
||||
public boolean containsRange(final Range<T> otherRange) {
|
||||
if (otherRange == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ public final class Range<T> implements Serializable {
|
|||
* @return true if this range is completely after the specified range
|
||||
* @throws RuntimeException if ranges cannot be compared
|
||||
*/
|
||||
public boolean isAfterRange(Range<T> otherRange) {
|
||||
public boolean isAfterRange(final Range<T> otherRange) {
|
||||
if (otherRange == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ public final class Range<T> implements Serializable {
|
|||
* range; otherwise, {@code false}
|
||||
* @throws RuntimeException if ranges cannot be compared
|
||||
*/
|
||||
public boolean isOverlappedBy(Range<T> otherRange) {
|
||||
public boolean isOverlappedBy(final Range<T> otherRange) {
|
||||
if (otherRange == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ public final class Range<T> implements Serializable {
|
|||
* @return true if this range is completely before the specified range
|
||||
* @throws RuntimeException if ranges cannot be compared
|
||||
*/
|
||||
public boolean isBeforeRange(Range<T> otherRange) {
|
||||
public boolean isBeforeRange(final Range<T> otherRange) {
|
||||
if (otherRange == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ public final class Range<T> implements Serializable {
|
|||
* @throws IllegalArgumentException if {@code other} does not overlap {@code this}
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public Range<T> intersectionWith(Range<T> other) {
|
||||
public Range<T> intersectionWith(final Range<T> other) {
|
||||
if (!this.isOverlappedBy(other)) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Cannot calculate intersection with non-overlapping range %s", other));
|
||||
|
@ -404,7 +404,7 @@ public final class Range<T> implements Serializable {
|
|||
* @return true if this object is equal
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
} else if (obj == null || obj.getClass() != getClass()) {
|
||||
|
@ -470,7 +470,7 @@ public final class Range<T> implements Serializable {
|
|||
* @param format the format string, optionally containing {@code %1$s}, {@code %2$s} and {@code %3$s}, not null
|
||||
* @return the formatted string, not null
|
||||
*/
|
||||
public String toString(String format) {
|
||||
public String toString(final String format) {
|
||||
return String.format(format, minimum, maximum, comparator);
|
||||
}
|
||||
|
||||
|
@ -486,7 +486,7 @@ public final class Range<T> implements Serializable {
|
|||
* @return negative, 0, positive comparison value
|
||||
*/
|
||||
@Override
|
||||
public int compare(Object obj1, Object obj2) {
|
||||
public int compare(final Object obj1, final Object obj2) {
|
||||
return ((Comparable) obj1).compareTo(obj2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SerializationException extends RuntimeException {
|
|||
*
|
||||
* @param msg The error message.
|
||||
*/
|
||||
public SerializationException(String msg) {
|
||||
public SerializationException(final String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class SerializationException extends RuntimeException {
|
|||
* @param cause The {@code Exception} or {@code Error}
|
||||
* that caused this exception to be thrown.
|
||||
*/
|
||||
public SerializationException(Throwable cause) {
|
||||
public SerializationException(final Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class SerializationException extends RuntimeException {
|
|||
* @param cause The {@code Exception} or {@code Error}
|
||||
* that caused this exception to be thrown.
|
||||
*/
|
||||
public SerializationException(String msg, Throwable cause) {
|
||||
public SerializationException(final String msg, final Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public class SerializationUtils {
|
|||
* @return the cloned object
|
||||
* @throws SerializationException (runtime) if the serialization fails
|
||||
*/
|
||||
public static <T extends Serializable> T clone(T object) {
|
||||
public static <T extends Serializable> T clone(final T object) {
|
||||
if (object == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class SerializationUtils {
|
|||
* @throws IllegalArgumentException if {@code outputStream} is {@code null}
|
||||
* @throws SerializationException (runtime) if the serialization fails
|
||||
*/
|
||||
public static void serialize(Serializable obj, OutputStream outputStream) {
|
||||
public static void serialize(final Serializable obj, final OutputStream outputStream) {
|
||||
if (outputStream == null) {
|
||||
throw new IllegalArgumentException("The OutputStream must not be null");
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ public class SerializationUtils {
|
|||
* @return a byte[] with the converted Serializable
|
||||
* @throws SerializationException (runtime) if the serialization fails
|
||||
*/
|
||||
public static byte[] serialize(Serializable obj) {
|
||||
public static byte[] serialize(final Serializable obj) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
|
||||
serialize(obj, baos);
|
||||
return baos.toByteArray();
|
||||
|
@ -197,7 +197,7 @@ public class SerializationUtils {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// Don't warn about "(T) deserialize" because we want the avoid type casting call sites.
|
||||
public static <T> T deserialize(InputStream inputStream) {
|
||||
public static <T> T deserialize(final InputStream inputStream) {
|
||||
if (inputStream == null) {
|
||||
throw new IllegalArgumentException("The InputStream must not be null");
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ public class SerializationUtils {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// Don't warn about "(T) deserialize" because we want the avoid type casting call sites.
|
||||
public static <T> T deserialize(byte[] objectData) {
|
||||
public static <T> T deserialize(final byte[] objectData) {
|
||||
if (objectData == null) {
|
||||
throw new IllegalArgumentException("The byte[] must not be null");
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ public class SerializationUtils {
|
|||
* @throws IOException if an I/O error occurs while reading stream header.
|
||||
* @see java.io.ObjectInputStream
|
||||
*/
|
||||
public ClassLoaderAwareObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException {
|
||||
public ClassLoaderAwareObjectInputStream(final InputStream in, final ClassLoader classLoader) throws IOException {
|
||||
super(in);
|
||||
this.classLoader = classLoader;
|
||||
|
||||
|
@ -299,7 +299,7 @@ public class SerializationUtils {
|
|||
* @throws ClassNotFoundException If class of a serialized object cannot be found.
|
||||
*/
|
||||
@Override
|
||||
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
|
||||
protected Class<?> resolveClass(final ObjectStreamClass desc) throws IOException, ClassNotFoundException {
|
||||
String name = desc.getName();
|
||||
try {
|
||||
return Class.forName(name, false, classLoader);
|
||||
|
|
|
@ -151,7 +151,7 @@ public class StringEscapeUtils {
|
|||
new char[] {CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF};
|
||||
|
||||
@Override
|
||||
public int translate(CharSequence input, int index, Writer out) throws IOException {
|
||||
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
|
||||
|
||||
if(index != 0) {
|
||||
throw new IllegalStateException("CsvEscaper should never reach the [1] index");
|
||||
|
@ -274,7 +274,7 @@ public class StringEscapeUtils {
|
|||
new char[] {CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF};
|
||||
|
||||
@Override
|
||||
public int translate(CharSequence input, int index, Writer out) throws IOException {
|
||||
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
|
||||
|
||||
if(index != 0) {
|
||||
throw new IllegalStateException("CsvUnescaper should never reach the [1] index");
|
||||
|
@ -337,7 +337,7 @@ public class StringEscapeUtils {
|
|||
* @param input String to escape values in, may be null
|
||||
* @return String with escaped values, {@code null} if null string input
|
||||
*/
|
||||
public static final String escapeJava(String input) {
|
||||
public static final String escapeJava(final String input) {
|
||||
return ESCAPE_JAVA.translate(input);
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ public class StringEscapeUtils {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static final String escapeEcmaScript(String input) {
|
||||
public static final String escapeEcmaScript(final String input) {
|
||||
return ESCAPE_ECMASCRIPT.translate(input);
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ public class StringEscapeUtils {
|
|||
* @param input the {@code String} to unescape, may be null
|
||||
* @return a new unescaped {@code String}, {@code null} if null string input
|
||||
*/
|
||||
public static final String unescapeJava(String input) {
|
||||
public static final String unescapeJava(final String input) {
|
||||
return UNESCAPE_JAVA.translate(input);
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ public class StringEscapeUtils {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static final String unescapeEcmaScript(String input) {
|
||||
public static final String unescapeEcmaScript(final String input) {
|
||||
return UNESCAPE_ECMASCRIPT.translate(input);
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ public class StringEscapeUtils {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static final String escapeHtml4(String input) {
|
||||
public static final String escapeHtml4(final String input) {
|
||||
return ESCAPE_HTML4.translate(input);
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ public class StringEscapeUtils {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static final String escapeHtml3(String input) {
|
||||
public static final String escapeHtml3(final String input) {
|
||||
return ESCAPE_HTML3.translate(input);
|
||||
}
|
||||
|
||||
|
@ -464,7 +464,7 @@ public class StringEscapeUtils {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static final String unescapeHtml4(String input) {
|
||||
public static final String unescapeHtml4(final String input) {
|
||||
return UNESCAPE_HTML4.translate(input);
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,7 @@ public class StringEscapeUtils {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static final String unescapeHtml3(String input) {
|
||||
public static final String unescapeHtml3(final String input) {
|
||||
return UNESCAPE_HTML3.translate(input);
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ public class StringEscapeUtils {
|
|||
* @return a new escaped {@code String}, {@code null} if null string input
|
||||
* @see #unescapeXml(java.lang.String)
|
||||
*/
|
||||
public static final String escapeXml(String input) {
|
||||
public static final String escapeXml(final String input) {
|
||||
return ESCAPE_XML.translate(input);
|
||||
}
|
||||
|
||||
|
@ -523,7 +523,7 @@ public class StringEscapeUtils {
|
|||
* @return a new unescaped {@code String}, {@code null} if null string input
|
||||
* @see #escapeXml(String)
|
||||
*/
|
||||
public static final String unescapeXml(String input) {
|
||||
public static final String unescapeXml(final String input) {
|
||||
return UNESCAPE_XML.translate(input);
|
||||
}
|
||||
|
||||
|
@ -552,7 +552,7 @@ public class StringEscapeUtils {
|
|||
* newline or double quote, {@code null} if null string input
|
||||
* @since 2.4
|
||||
*/
|
||||
public static final String escapeCsv(String input) {
|
||||
public static final String escapeCsv(final String input) {
|
||||
return ESCAPE_CSV.translate(input);
|
||||
}
|
||||
|
||||
|
@ -578,7 +578,7 @@ public class StringEscapeUtils {
|
|||
* quotes unescaped, {@code null} if null string input
|
||||
* @since 2.4
|
||||
*/
|
||||
public static final String unescapeCsv(String input) {
|
||||
public static final String unescapeCsv(final String input) {
|
||||
return UNESCAPE_CSV.translate(input);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1278,7 +1278,7 @@ public class SystemUtils {
|
|||
* @param versionPrefix the prefix for the java version
|
||||
* @return true if matches, or false if not or can't determine
|
||||
*/
|
||||
private static boolean getJavaVersionMatches(String versionPrefix) {
|
||||
private static boolean getJavaVersionMatches(final String versionPrefix) {
|
||||
return isJavaVersionMatch(JAVA_SPECIFICATION_VERSION, versionPrefix);
|
||||
}
|
||||
|
||||
|
@ -1289,7 +1289,7 @@ public class SystemUtils {
|
|||
* @param osVersionPrefix the prefix for the version
|
||||
* @return true if matches, or false if not or can't determine
|
||||
*/
|
||||
private static boolean getOSMatches(String osNamePrefix, String osVersionPrefix) {
|
||||
private static boolean getOSMatches(final String osNamePrefix, final String osVersionPrefix) {
|
||||
return isOSMatch(OS_NAME, OS_VERSION, osNamePrefix, osVersionPrefix);
|
||||
}
|
||||
|
||||
|
@ -1299,7 +1299,7 @@ public class SystemUtils {
|
|||
* @param osNamePrefix the prefix for the os name
|
||||
* @return true if matches, or false if not or can't determine
|
||||
*/
|
||||
private static boolean getOSMatchesName(String osNamePrefix) {
|
||||
private static boolean getOSMatchesName(final String osNamePrefix) {
|
||||
return isOSNameMatch(OS_NAME, osNamePrefix);
|
||||
}
|
||||
|
||||
|
@ -1316,7 +1316,7 @@ public class SystemUtils {
|
|||
* @param property the system property name
|
||||
* @return the system property value or {@code null} if a security problem occurs
|
||||
*/
|
||||
private static String getSystemProperty(String property) {
|
||||
private static String getSystemProperty(final String property) {
|
||||
try {
|
||||
return System.getProperty(property);
|
||||
} catch (SecurityException ex) {
|
||||
|
@ -1384,7 +1384,7 @@ public class SystemUtils {
|
|||
* @param requiredVersion the required version, for example 1.31f
|
||||
* @return {@code true} if the actual version is equal or greater than the required version
|
||||
*/
|
||||
public static boolean isJavaVersionAtLeast(JavaVersion requiredVersion) {
|
||||
public static boolean isJavaVersionAtLeast(final JavaVersion requiredVersion) {
|
||||
return JAVA_SPECIFICATION_VERSION_AS_ENUM.atLeast(requiredVersion);
|
||||
}
|
||||
|
||||
|
@ -1400,7 +1400,7 @@ public class SystemUtils {
|
|||
* @param versionPrefix the prefix for the expected Java version
|
||||
* @return true if matches, or false if not or can't determine
|
||||
*/
|
||||
static boolean isJavaVersionMatch(String version, String versionPrefix) {
|
||||
static boolean isJavaVersionMatch(final String version, final String versionPrefix) {
|
||||
if (version == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1419,7 +1419,7 @@ public class SystemUtils {
|
|||
* @param osVersionPrefix the prefix for the expected OS version
|
||||
* @return true if matches, or false if not or can't determine
|
||||
*/
|
||||
static boolean isOSMatch(String osName, String osVersion, String osNamePrefix, String osVersionPrefix) {
|
||||
static boolean isOSMatch(final String osName, final String osVersion, final String osNamePrefix, final String osVersionPrefix) {
|
||||
if (osName == null || osVersion == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1436,7 +1436,7 @@ public class SystemUtils {
|
|||
* @param osNamePrefix the prefix for the expected OS name
|
||||
* @return true if matches, or false if not or can't determine
|
||||
*/
|
||||
static boolean isOSNameMatch(String osName, String osNamePrefix) {
|
||||
static boolean isOSNameMatch(final String osName, final String osNamePrefix) {
|
||||
if (osName == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ public class Validate {
|
|||
* @see #isTrue(boolean, String, double)
|
||||
* @see #isTrue(boolean, String, Object...)
|
||||
*/
|
||||
public static void isTrue(boolean expression, String message, long value) {
|
||||
public static void isTrue(final boolean expression, final String message, final long value) {
|
||||
if (expression == false) {
|
||||
throw new IllegalArgumentException(String.format(message, Long.valueOf(value)));
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class Validate {
|
|||
* @see #isTrue(boolean, String, long)
|
||||
* @see #isTrue(boolean, String, Object...)
|
||||
*/
|
||||
public static void isTrue(boolean expression, String message, double value) {
|
||||
public static void isTrue(final boolean expression, final String message, final double value) {
|
||||
if (expression == false) {
|
||||
throw new IllegalArgumentException(String.format(message, Double.valueOf(value)));
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public class Validate {
|
|||
* @see #isTrue(boolean, String, long)
|
||||
* @see #isTrue(boolean, String, double)
|
||||
*/
|
||||
public static void isTrue(boolean expression, String message, Object... values) {
|
||||
public static void isTrue(final boolean expression, final String message, final Object... values) {
|
||||
if (expression == false) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public class Validate {
|
|||
* @see #isTrue(boolean, String, double)
|
||||
* @see #isTrue(boolean, String, Object...)
|
||||
*/
|
||||
public static void isTrue(boolean expression) {
|
||||
public static void isTrue(final boolean expression) {
|
||||
if (expression == false) {
|
||||
throw new IllegalArgumentException(DEFAULT_IS_TRUE_EX_MESSAGE);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ public class Validate {
|
|||
* @throws NullPointerException if the object is {@code null}
|
||||
* @see #notNull(Object, String, Object...)
|
||||
*/
|
||||
public static <T> T notNull(T object) {
|
||||
public static <T> T notNull(final T object) {
|
||||
return notNull(object, DEFAULT_IS_NULL_EX_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ public class Validate {
|
|||
* @throws NullPointerException if the object is {@code null}
|
||||
* @see #notNull(Object)
|
||||
*/
|
||||
public static <T> T notNull(T object, String message, Object... values) {
|
||||
public static <T> T notNull(final T object, final String message, final Object... values) {
|
||||
if (object == null) {
|
||||
throw new NullPointerException(String.format(message, values));
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the array is empty
|
||||
* @see #notEmpty(Object[])
|
||||
*/
|
||||
public static <T> T[] notEmpty(T[] array, String message, Object... values) {
|
||||
public static <T> T[] notEmpty(final T[] array, final String message, final Object... values) {
|
||||
if (array == null) {
|
||||
throw new NullPointerException(String.format(message, values));
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the array is empty
|
||||
* @see #notEmpty(Object[], String, Object...)
|
||||
*/
|
||||
public static <T> T[] notEmpty(T[] array) {
|
||||
public static <T> T[] notEmpty(final T[] array) {
|
||||
return notEmpty(array, DEFAULT_NOT_EMPTY_ARRAY_EX_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the collection is empty
|
||||
* @see #notEmpty(Object[])
|
||||
*/
|
||||
public static <T extends Collection<?>> T notEmpty(T collection, String message, Object... values) {
|
||||
public static <T extends Collection<?>> T notEmpty(final T collection, final String message, final Object... values) {
|
||||
if (collection == null) {
|
||||
throw new NullPointerException(String.format(message, values));
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the collection is empty
|
||||
* @see #notEmpty(Collection, String, Object...)
|
||||
*/
|
||||
public static <T extends Collection<?>> T notEmpty(T collection) {
|
||||
public static <T extends Collection<?>> T notEmpty(final T collection) {
|
||||
return notEmpty(collection, DEFAULT_NOT_EMPTY_COLLECTION_EX_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the map is empty
|
||||
* @see #notEmpty(Object[])
|
||||
*/
|
||||
public static <T extends Map<?, ?>> T notEmpty(T map, String message, Object... values) {
|
||||
public static <T extends Map<?, ?>> T notEmpty(final T map, final String message, final Object... values) {
|
||||
if (map == null) {
|
||||
throw new NullPointerException(String.format(message, values));
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the map is empty
|
||||
* @see #notEmpty(Map, String, Object...)
|
||||
*/
|
||||
public static <T extends Map<?, ?>> T notEmpty(T map) {
|
||||
public static <T extends Map<?, ?>> T notEmpty(final T map) {
|
||||
return notEmpty(map, DEFAULT_NOT_EMPTY_MAP_EX_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the character sequence is empty
|
||||
* @see #notEmpty(CharSequence)
|
||||
*/
|
||||
public static <T extends CharSequence> T notEmpty(T chars, String message, Object... values) {
|
||||
public static <T extends CharSequence> T notEmpty(final T chars, final String message, final Object... values) {
|
||||
if (chars == null) {
|
||||
throw new NullPointerException(String.format(message, values));
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the character sequence is empty
|
||||
* @see #notEmpty(CharSequence, String, Object...)
|
||||
*/
|
||||
public static <T extends CharSequence> T notEmpty(T chars) {
|
||||
public static <T extends CharSequence> T notEmpty(final T chars) {
|
||||
return notEmpty(chars, DEFAULT_NOT_EMPTY_CHAR_SEQUENCE_EX_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T extends CharSequence> T notBlank(T chars, String message, Object... values) {
|
||||
public static <T extends CharSequence> T notBlank(final T chars, final String message, final Object... values) {
|
||||
if (chars == null) {
|
||||
throw new NullPointerException(String.format(message, values));
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T extends CharSequence> T notBlank(T chars) {
|
||||
public static <T extends CharSequence> T notBlank(final T chars) {
|
||||
return notBlank(chars, DEFAULT_NOT_BLANK_EX_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if an element is {@code null}
|
||||
* @see #noNullElements(Object[])
|
||||
*/
|
||||
public static <T> T[] noNullElements(T[] array, String message, Object... values) {
|
||||
public static <T> T[] noNullElements(final T[] array, final String message, final Object... values) {
|
||||
Validate.notNull(array);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] == null) {
|
||||
|
@ -534,7 +534,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if an element is {@code null}
|
||||
* @see #noNullElements(Object[], String, Object...)
|
||||
*/
|
||||
public static <T> T[] noNullElements(T[] array) {
|
||||
public static <T> T[] noNullElements(final T[] array) {
|
||||
return noNullElements(array, DEFAULT_NO_NULL_ELEMENTS_ARRAY_EX_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -564,7 +564,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if an element is {@code null}
|
||||
* @see #noNullElements(Iterable)
|
||||
*/
|
||||
public static <T extends Iterable<?>> T noNullElements(T iterable, String message, Object... values) {
|
||||
public static <T extends Iterable<?>> T noNullElements(final T iterable, final String message, final Object... values) {
|
||||
Validate.notNull(iterable);
|
||||
int i = 0;
|
||||
for (Iterator<?> it = iterable.iterator(); it.hasNext(); i++) {
|
||||
|
@ -597,7 +597,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if an element is {@code null}
|
||||
* @see #noNullElements(Iterable, String, Object...)
|
||||
*/
|
||||
public static <T extends Iterable<?>> T noNullElements(T iterable) {
|
||||
public static <T extends Iterable<?>> T noNullElements(final T iterable) {
|
||||
return noNullElements(iterable, DEFAULT_NO_NULL_ELEMENTS_COLLECTION_EX_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T> T[] validIndex(T[] array, int index, String message, Object... values) {
|
||||
public static <T> T[] validIndex(final T[] array, final int index, final String message, final Object... values) {
|
||||
Validate.notNull(array);
|
||||
if (index < 0 || index >= array.length) {
|
||||
throw new IndexOutOfBoundsException(String.format(message, values));
|
||||
|
@ -656,7 +656,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T> T[] validIndex(T[] array, int index) {
|
||||
public static <T> T[] validIndex(final T[] array, final int index) {
|
||||
return validIndex(array, index, DEFAULT_VALID_INDEX_ARRAY_EX_MESSAGE, Integer.valueOf(index));
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T extends Collection<?>> T validIndex(T collection, int index, String message, Object... values) {
|
||||
public static <T extends Collection<?>> T validIndex(final T collection, final int index, final String message, final Object... values) {
|
||||
Validate.notNull(collection);
|
||||
if (index < 0 || index >= collection.size()) {
|
||||
throw new IndexOutOfBoundsException(String.format(message, values));
|
||||
|
@ -712,7 +712,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T extends Collection<?>> T validIndex(T collection, int index) {
|
||||
public static <T extends Collection<?>> T validIndex(final T collection, final int index) {
|
||||
return validIndex(collection, index, DEFAULT_VALID_INDEX_COLLECTION_EX_MESSAGE, Integer.valueOf(index));
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T extends CharSequence> T validIndex(T chars, int index, String message, Object... values) {
|
||||
public static <T extends CharSequence> T validIndex(final T chars, final int index, final String message, final Object... values) {
|
||||
Validate.notNull(chars);
|
||||
if (index < 0 || index >= chars.length()) {
|
||||
throw new IndexOutOfBoundsException(String.format(message, values));
|
||||
|
@ -773,7 +773,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T extends CharSequence> T validIndex(T chars, int index) {
|
||||
public static <T extends CharSequence> T validIndex(final T chars, final int index) {
|
||||
return validIndex(chars, index, DEFAULT_VALID_INDEX_CHAR_SEQUENCE_EX_MESSAGE, Integer.valueOf(index));
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static void validState(boolean expression) {
|
||||
public static void validState(final boolean expression) {
|
||||
if (expression == false) {
|
||||
throw new IllegalStateException(DEFAULT_VALID_STATE_EX_MESSAGE);
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static void validState(boolean expression, String message, Object... values) {
|
||||
public static void validState(final boolean expression, final String message, final Object... values) {
|
||||
if (expression == false) {
|
||||
throw new IllegalStateException(String.format(message, values));
|
||||
}
|
||||
|
@ -845,7 +845,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static void matchesPattern(CharSequence input, String pattern) {
|
||||
public static void matchesPattern(final CharSequence input, final String pattern) {
|
||||
// TODO when breaking BC, consider returning input
|
||||
if (Pattern.matches(pattern, input) == false) {
|
||||
throw new IllegalArgumentException(String.format(DEFAULT_MATCHES_PATTERN_EX, input, pattern));
|
||||
|
@ -869,7 +869,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static void matchesPattern(CharSequence input, String pattern, String message, Object... values) {
|
||||
public static void matchesPattern(final CharSequence input, final String pattern, final String message, final Object... values) {
|
||||
// TODO when breaking BC, consider returning input
|
||||
if (Pattern.matches(pattern, input) == false) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
|
@ -894,7 +894,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T> void inclusiveBetween(T start, T end, Comparable<T> value) {
|
||||
public static <T> void inclusiveBetween(final T start, final T end, final Comparable<T> value) {
|
||||
// TODO when breaking BC, consider returning value
|
||||
if (value.compareTo(start) < 0 || value.compareTo(end) > 0) {
|
||||
throw new IllegalArgumentException(String.format(DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end));
|
||||
|
@ -919,7 +919,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T> void inclusiveBetween(T start, T end, Comparable<T> value, String message, Object... values) {
|
||||
public static <T> void inclusiveBetween(final T start, final T end, final Comparable<T> value, final String message, final Object... values) {
|
||||
// TODO when breaking BC, consider returning value
|
||||
if (value.compareTo(start) < 0 || value.compareTo(end) > 0) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
|
@ -944,7 +944,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T> void exclusiveBetween(T start, T end, Comparable<T> value) {
|
||||
public static <T> void exclusiveBetween(final T start, final T end, final Comparable<T> value) {
|
||||
// TODO when breaking BC, consider returning value
|
||||
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) {
|
||||
throw new IllegalArgumentException(String.format(DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end));
|
||||
|
@ -969,7 +969,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static <T> void exclusiveBetween(T start, T end, Comparable<T> value, String message, Object... values) {
|
||||
public static <T> void exclusiveBetween(final T start, final T end, final Comparable<T> value, final String message, final Object... values) {
|
||||
// TODO when breaking BC, consider returning value
|
||||
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
|
@ -995,7 +995,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static void isInstanceOf(Class<?> type, Object obj) {
|
||||
public static void isInstanceOf(final Class<?> type, final Object obj) {
|
||||
// TODO when breaking BC, consider returning obj
|
||||
if (type.isInstance(obj) == false) {
|
||||
throw new IllegalArgumentException(String.format(DEFAULT_IS_INSTANCE_OF_EX_MESSAGE, type.getName(),
|
||||
|
@ -1020,7 +1020,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static void isInstanceOf(Class<?> type, Object obj, String message, Object... values) {
|
||||
public static void isInstanceOf(final Class<?> type, final Object obj, final String message, final Object... values) {
|
||||
// TODO when breaking BC, consider returning obj
|
||||
if (type.isInstance(obj) == false) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
|
@ -1046,7 +1046,7 @@ public class Validate {
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static void isAssignableFrom(Class<?> superType, Class<?> type) {
|
||||
public static void isAssignableFrom(final Class<?> superType, final Class<?> type) {
|
||||
// TODO when breaking BC, consider returning type
|
||||
if (superType.isAssignableFrom(type) == false) {
|
||||
throw new IllegalArgumentException(String.format(DEFAULT_IS_ASSIGNABLE_EX_MESSAGE, type == null ? "null" : type.getName(),
|
||||
|
@ -1071,7 +1071,7 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if argument can not be converted to the specified class
|
||||
* @see #isAssignableFrom(Class, Class)
|
||||
*/
|
||||
public static void isAssignableFrom(Class<?> superType, Class<?> type, String message, Object... values) {
|
||||
public static void isAssignableFrom(final Class<?> superType, final Class<?> type, final String message, final Object... values) {
|
||||
// TODO when breaking BC, consider returning type
|
||||
if (superType.isAssignableFrom(type) == false) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
|
|
|
@ -131,7 +131,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @throws ClassCastException if <code>rhs</code> is not assignment-compatible
|
||||
* with <code>lhs</code>
|
||||
*/
|
||||
public static int reflectionCompare(Object lhs, Object rhs) {
|
||||
public static int reflectionCompare(final Object lhs, final Object rhs) {
|
||||
return reflectionCompare(lhs, rhs, false, null);
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @throws ClassCastException if <code>rhs</code> is not assignment-compatible
|
||||
* with <code>lhs</code>
|
||||
*/
|
||||
public static int reflectionCompare(Object lhs, Object rhs, boolean compareTransients) {
|
||||
public static int reflectionCompare(final Object lhs, final Object rhs, final boolean compareTransients) {
|
||||
return reflectionCompare(lhs, rhs, compareTransients, null);
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* with <code>lhs</code>
|
||||
* @since 2.2
|
||||
*/
|
||||
public static int reflectionCompare(Object lhs, Object rhs, Collection<String> excludeFields) {
|
||||
public static int reflectionCompare(final Object lhs, final Object rhs, final Collection<String> excludeFields) {
|
||||
return reflectionCompare(lhs, rhs, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* with <code>lhs</code>
|
||||
* @since 2.2
|
||||
*/
|
||||
public static int reflectionCompare(Object lhs, Object rhs, String... excludeFields) {
|
||||
public static int reflectionCompare(final Object lhs, final Object rhs, final String... excludeFields) {
|
||||
return reflectionCompare(lhs, rhs, false, null, excludeFields);
|
||||
}
|
||||
|
||||
|
@ -266,11 +266,11 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @since 2.2 (2.0 as <code>reflectionCompare(Object, Object, boolean, Class)</code>)
|
||||
*/
|
||||
public static int reflectionCompare(
|
||||
Object lhs,
|
||||
Object rhs,
|
||||
boolean compareTransients,
|
||||
Class<?> reflectUpToClass,
|
||||
String... excludeFields) {
|
||||
final Object lhs,
|
||||
final Object rhs,
|
||||
final boolean compareTransients,
|
||||
final Class<?> reflectUpToClass,
|
||||
final String... excludeFields) {
|
||||
|
||||
if (lhs == rhs) {
|
||||
return 0;
|
||||
|
@ -303,12 +303,12 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param excludeFields fields to exclude
|
||||
*/
|
||||
private static void reflectionAppend(
|
||||
Object lhs,
|
||||
Object rhs,
|
||||
Class<?> clazz,
|
||||
CompareToBuilder builder,
|
||||
boolean useTransients,
|
||||
String[] excludeFields) {
|
||||
final Object lhs,
|
||||
final Object rhs,
|
||||
final Class<?> clazz,
|
||||
final CompareToBuilder builder,
|
||||
final boolean useTransients,
|
||||
final String[] excludeFields) {
|
||||
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
AccessibleObject.setAccessible(fields, true);
|
||||
|
@ -338,7 +338,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @return this - used to chain append calls
|
||||
* @since 2.0
|
||||
*/
|
||||
public CompareToBuilder appendSuper(int superCompareTo) {
|
||||
public CompareToBuilder appendSuper(final int superCompareTo) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @throws ClassCastException if <code>rhs</code> is not assignment-compatible
|
||||
* with <code>lhs</code>
|
||||
*/
|
||||
public CompareToBuilder append(Object lhs, Object rhs) {
|
||||
public CompareToBuilder append(final Object lhs, final Object rhs) {
|
||||
return append(lhs, rhs, null);
|
||||
}
|
||||
|
||||
|
@ -395,7 +395,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* with <code>lhs</code>
|
||||
* @since 2.0
|
||||
*/
|
||||
public CompareToBuilder append(Object lhs, Object rhs, Comparator<?> comparator) {
|
||||
public CompareToBuilder append(final Object lhs, final Object rhs, final Comparator<?> comparator) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand value
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(long lhs, long rhs) {
|
||||
public CompareToBuilder append(final long lhs, final long rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand value
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(int lhs, int rhs) {
|
||||
public CompareToBuilder append(final int lhs, final int rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand value
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(short lhs, short rhs) {
|
||||
public CompareToBuilder append(final short lhs, final short rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand value
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(char lhs, char rhs) {
|
||||
public CompareToBuilder append(final char lhs, final char rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand value
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(byte lhs, byte rhs) {
|
||||
public CompareToBuilder append(final byte lhs, final byte rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand value
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(double lhs, double rhs) {
|
||||
public CompareToBuilder append(final double lhs, final double rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand value
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(float lhs, float rhs) {
|
||||
public CompareToBuilder append(final float lhs, final float rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand value
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(boolean lhs, boolean rhs) {
|
||||
public CompareToBuilder append(final boolean lhs, final boolean rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @throws ClassCastException if <code>rhs</code> is not assignment-compatible
|
||||
* with <code>lhs</code>
|
||||
*/
|
||||
public CompareToBuilder append(Object[] lhs, Object[] rhs) {
|
||||
public CompareToBuilder append(final Object[] lhs, final Object[] rhs) {
|
||||
return append(lhs, rhs, null);
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* with <code>lhs</code>
|
||||
* @since 2.0
|
||||
*/
|
||||
public CompareToBuilder append(Object[] lhs, Object[] rhs, Comparator<?> comparator) {
|
||||
public CompareToBuilder append(final Object[] lhs, final Object[] rhs, final Comparator<?> comparator) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -684,7 +684,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand array
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(long[] lhs, long[] rhs) {
|
||||
public CompareToBuilder append(final long[] lhs, final long[] rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -724,7 +724,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand array
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(int[] lhs, int[] rhs) {
|
||||
public CompareToBuilder append(final int[] lhs, final int[] rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand array
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(short[] lhs, short[] rhs) {
|
||||
public CompareToBuilder append(final short[] lhs, final short[] rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -804,7 +804,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand array
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(char[] lhs, char[] rhs) {
|
||||
public CompareToBuilder append(final char[] lhs, final char[] rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -844,7 +844,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand array
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(byte[] lhs, byte[] rhs) {
|
||||
public CompareToBuilder append(final byte[] lhs, final byte[] rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand array
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(double[] lhs, double[] rhs) {
|
||||
public CompareToBuilder append(final double[] lhs, final double[] rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -924,7 +924,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand array
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(float[] lhs, float[] rhs) {
|
||||
public CompareToBuilder append(final float[] lhs, final float[] rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
@ -964,7 +964,7 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* @param rhs right-hand array
|
||||
* @return this - used to chain append calls
|
||||
*/
|
||||
public CompareToBuilder append(boolean[] lhs, boolean[] rhs) {
|
||||
public CompareToBuilder append(final boolean[] lhs, final boolean[] rhs) {
|
||||
if (comparison != 0) {
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
*
|
||||
* @return the pair
|
||||
*/
|
||||
static Pair<IDKey, IDKey> getRegisterPair(Object lhs, Object rhs) {
|
||||
static Pair<IDKey, IDKey> getRegisterPair(final Object lhs, final Object rhs) {
|
||||
IDKey left = new IDKey(lhs);
|
||||
IDKey right = new IDKey(rhs);
|
||||
return Pair.of(left, right);
|
||||
|
@ -150,7 +150,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @return boolean <code>true</code> if the registry contains the given object.
|
||||
* @since 3.0
|
||||
*/
|
||||
static boolean isRegistered(Object lhs, Object rhs) {
|
||||
static boolean isRegistered(final Object lhs, final Object rhs) {
|
||||
Set<Pair<IDKey, IDKey>> registry = getRegistry();
|
||||
Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs);
|
||||
Pair<IDKey, IDKey> swappedPair = Pair.of(pair.getLeft(), pair.getRight());
|
||||
|
@ -168,7 +168,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param lhs <code>this</code> object to register
|
||||
* @param rhs the other object to register
|
||||
*/
|
||||
static void register(Object lhs, Object rhs) {
|
||||
static void register(final Object lhs, final Object rhs) {
|
||||
synchronized (EqualsBuilder.class) {
|
||||
if (getRegistry() == null) {
|
||||
REGISTRY.set(new HashSet<Pair<IDKey, IDKey>>());
|
||||
|
@ -192,7 +192,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the other object to unregister
|
||||
* @since 3.0
|
||||
*/
|
||||
static void unregister(Object lhs, Object rhs) {
|
||||
static void unregister(final Object lhs, final Object rhs) {
|
||||
Set<Pair<IDKey, IDKey>> registry = getRegistry();
|
||||
if (registry != null) {
|
||||
Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs);
|
||||
|
@ -244,7 +244,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param excludeFields Collection of String field names to exclude from testing
|
||||
* @return <code>true</code> if the two Objects have tested equals.
|
||||
*/
|
||||
public static boolean reflectionEquals(Object lhs, Object rhs, Collection<String> excludeFields) {
|
||||
public static boolean reflectionEquals(final Object lhs, final Object rhs, final Collection<String> excludeFields) {
|
||||
return reflectionEquals(lhs, rhs, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param excludeFields array of field names to exclude from testing
|
||||
* @return <code>true</code> if the two Objects have tested equals.
|
||||
*/
|
||||
public static boolean reflectionEquals(Object lhs, Object rhs, String... excludeFields) {
|
||||
public static boolean reflectionEquals(final Object lhs, final Object rhs, final String... excludeFields) {
|
||||
return reflectionEquals(lhs, rhs, false, null, excludeFields);
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param testTransients whether to include transient fields
|
||||
* @return <code>true</code> if the two Objects have tested equals.
|
||||
*/
|
||||
public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients) {
|
||||
public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients) {
|
||||
return reflectionEquals(lhs, rhs, testTransients, null);
|
||||
}
|
||||
|
||||
|
@ -321,8 +321,8 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @return <code>true</code> if the two Objects have tested equals.
|
||||
* @since 2.0
|
||||
*/
|
||||
public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients, Class<?> reflectUpToClass,
|
||||
String... excludeFields) {
|
||||
public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients, final Class<?> reflectUpToClass,
|
||||
final String... excludeFields) {
|
||||
if (lhs == rhs) {
|
||||
return true;
|
||||
}
|
||||
|
@ -382,12 +382,12 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param excludeFields array of field names to exclude from testing
|
||||
*/
|
||||
private static void reflectionAppend(
|
||||
Object lhs,
|
||||
Object rhs,
|
||||
Class<?> clazz,
|
||||
EqualsBuilder builder,
|
||||
boolean useTransients,
|
||||
String[] excludeFields) {
|
||||
final Object lhs,
|
||||
final Object rhs,
|
||||
final Class<?> clazz,
|
||||
final EqualsBuilder builder,
|
||||
final boolean useTransients,
|
||||
final String[] excludeFields) {
|
||||
|
||||
if (isRegistered(lhs, rhs)) {
|
||||
return;
|
||||
|
@ -426,7 +426,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @return EqualsBuilder - used to chain calls.
|
||||
* @since 2.0
|
||||
*/
|
||||
public EqualsBuilder appendSuper(boolean superEquals) {
|
||||
public EqualsBuilder appendSuper(final boolean superEquals) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand object
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(Object lhs, Object rhs) {
|
||||
public EqualsBuilder append(final Object lhs, final Object rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* the right hand <code>long</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(long lhs, long rhs) {
|
||||
public EqualsBuilder append(final long lhs, final long rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>int</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(int lhs, int rhs) {
|
||||
public EqualsBuilder append(final int lhs, final int rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>short</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(short lhs, short rhs) {
|
||||
public EqualsBuilder append(final short lhs, final short rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>char</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(char lhs, char rhs) {
|
||||
public EqualsBuilder append(final char lhs, final char rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>byte</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(byte lhs, byte rhs) {
|
||||
public EqualsBuilder append(final byte lhs, final byte rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>double</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(double lhs, double rhs) {
|
||||
public EqualsBuilder append(final double lhs, final double rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -600,7 +600,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>float</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(float lhs, float rhs) {
|
||||
public EqualsBuilder append(final float lhs, final float rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>boolean</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(boolean lhs, boolean rhs) {
|
||||
public EqualsBuilder append(final boolean lhs, final boolean rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>Object[]</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(Object[] lhs, Object[] rhs) {
|
||||
public EqualsBuilder append(final Object[] lhs, final Object[] rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -663,7 +663,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>long[]</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(long[] lhs, long[] rhs) {
|
||||
public EqualsBuilder append(final long[] lhs, final long[] rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -694,7 +694,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>int[]</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(int[] lhs, int[] rhs) {
|
||||
public EqualsBuilder append(final int[] lhs, final int[] rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -725,7 +725,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>short[]</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(short[] lhs, short[] rhs) {
|
||||
public EqualsBuilder append(final short[] lhs, final short[] rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>char[]</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(char[] lhs, char[] rhs) {
|
||||
public EqualsBuilder append(final char[] lhs, final char[] rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>byte[]</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(byte[] lhs, byte[] rhs) {
|
||||
public EqualsBuilder append(final byte[] lhs, final byte[] rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -818,7 +818,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>double[]</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(double[] lhs, double[] rhs) {
|
||||
public EqualsBuilder append(final double[] lhs, final double[] rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>float[]</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(float[] lhs, float[] rhs) {
|
||||
public EqualsBuilder append(final float[] lhs, final float[] rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -880,7 +880,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param rhs the right hand <code>boolean[]</code>
|
||||
* @return EqualsBuilder - used to chain calls.
|
||||
*/
|
||||
public EqualsBuilder append(boolean[] lhs, boolean[] rhs) {
|
||||
public EqualsBuilder append(final boolean[] lhs, final boolean[] rhs) {
|
||||
if (isEquals == false) {
|
||||
return this;
|
||||
}
|
||||
|
@ -931,7 +931,7 @@ public class EqualsBuilder implements Builder<Boolean> {
|
|||
* @param isEquals The value to set.
|
||||
* @since 2.1
|
||||
*/
|
||||
protected void setEquals(boolean isEquals) {
|
||||
protected void setEquals(final boolean isEquals) {
|
||||
this.isEquals = isEquals;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* @return boolean <code>true</code> if the registry contains the given object.
|
||||
* @since 2.3
|
||||
*/
|
||||
static boolean isRegistered(Object value) {
|
||||
static boolean isRegistered(final Object value) {
|
||||
Set<IDKey> registry = getRegistry();
|
||||
return registry != null && registry.contains(new IDKey(value));
|
||||
}
|
||||
|
@ -168,8 +168,8 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* @param excludeFields
|
||||
* Collection of String field names to exclude from use in calculation of hash code
|
||||
*/
|
||||
private static void reflectionAppend(Object object, Class<?> clazz, HashCodeBuilder builder, boolean useTransients,
|
||||
String[] excludeFields) {
|
||||
private static void reflectionAppend(final Object object, final Class<?> clazz, final HashCodeBuilder builder, final boolean useTransients,
|
||||
final String[] excludeFields) {
|
||||
if (isRegistered(object)) {
|
||||
return;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* @throws IllegalArgumentException
|
||||
* if the number is zero or even
|
||||
*/
|
||||
public static int reflectionHashCode(int initialNonZeroOddNumber, int multiplierNonZeroOddNumber, Object object) {
|
||||
public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object) {
|
||||
return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, false, null);
|
||||
}
|
||||
|
||||
|
@ -277,8 +277,8 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* @throws IllegalArgumentException
|
||||
* if the number is zero or even
|
||||
*/
|
||||
public static int reflectionHashCode(int initialNonZeroOddNumber, int multiplierNonZeroOddNumber, Object object,
|
||||
boolean testTransients) {
|
||||
public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object,
|
||||
final boolean testTransients) {
|
||||
return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, testTransients, null);
|
||||
}
|
||||
|
||||
|
@ -329,8 +329,8 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* if the number is zero or even
|
||||
* @since 2.0
|
||||
*/
|
||||
public static <T> int reflectionHashCode(int initialNonZeroOddNumber, int multiplierNonZeroOddNumber, T object,
|
||||
boolean testTransients, Class<? super T> reflectUpToClass, String... excludeFields) {
|
||||
public static <T> int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final T object,
|
||||
final boolean testTransients, final Class<? super T> reflectUpToClass, final String... excludeFields) {
|
||||
|
||||
if (object == null) {
|
||||
throw new IllegalArgumentException("The object to build a hash code for must not be null");
|
||||
|
@ -377,7 +377,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* @throws IllegalArgumentException
|
||||
* if the object is <code>null</code>
|
||||
*/
|
||||
public static int reflectionHashCode(Object object, boolean testTransients) {
|
||||
public static int reflectionHashCode(final Object object, final boolean testTransients) {
|
||||
return reflectionHashCode(17, 37, object, testTransients, null);
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* @throws IllegalArgumentException
|
||||
* if the object is <code>null</code>
|
||||
*/
|
||||
public static int reflectionHashCode(Object object, Collection<String> excludeFields) {
|
||||
public static int reflectionHashCode(final Object object, final Collection<String> excludeFields) {
|
||||
return reflectionHashCode(object, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* @throws IllegalArgumentException
|
||||
* if the object is <code>null</code>
|
||||
*/
|
||||
public static int reflectionHashCode(Object object, String... excludeFields) {
|
||||
public static int reflectionHashCode(final Object object, final String... excludeFields) {
|
||||
return reflectionHashCode(17, 37, object, false, null, excludeFields);
|
||||
}
|
||||
|
||||
|
@ -463,7 +463,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* @param value
|
||||
* The object to register.
|
||||
*/
|
||||
static void register(Object value) {
|
||||
static void register(final Object value) {
|
||||
synchronized (HashCodeBuilder.class) {
|
||||
if (getRegistry() == null) {
|
||||
REGISTRY.set(new HashSet<IDKey>());
|
||||
|
@ -484,7 +484,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* The object to unregister.
|
||||
* @since 2.3
|
||||
*/
|
||||
static void unregister(Object value) {
|
||||
static void unregister(final Object value) {
|
||||
Set<IDKey> registry = getRegistry();
|
||||
if (registry != null) {
|
||||
registry.remove(new IDKey(value));
|
||||
|
@ -535,7 +535,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* @throws IllegalArgumentException
|
||||
* if the number is zero or even
|
||||
*/
|
||||
public HashCodeBuilder(int initialNonZeroOddNumber, int multiplierNonZeroOddNumber) {
|
||||
public HashCodeBuilder(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber) {
|
||||
if (initialNonZeroOddNumber == 0) {
|
||||
throw new IllegalArgumentException("HashCodeBuilder requires a non zero initial value");
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the boolean to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(boolean value) {
|
||||
public HashCodeBuilder append(final boolean value) {
|
||||
iTotal = iTotal * iConstant + (value ? 0 : 1);
|
||||
return this;
|
||||
}
|
||||
|
@ -587,7 +587,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the array to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(boolean[] array) {
|
||||
public HashCodeBuilder append(final boolean[] array) {
|
||||
if (array == null) {
|
||||
iTotal = iTotal * iConstant;
|
||||
} else {
|
||||
|
@ -609,7 +609,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the byte to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(byte value) {
|
||||
public HashCodeBuilder append(final byte value) {
|
||||
iTotal = iTotal * iConstant + value;
|
||||
return this;
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the array to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(byte[] array) {
|
||||
public HashCodeBuilder append(final byte[] array) {
|
||||
if (array == null) {
|
||||
iTotal = iTotal * iConstant;
|
||||
} else {
|
||||
|
@ -645,7 +645,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the char to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(char value) {
|
||||
public HashCodeBuilder append(final char value) {
|
||||
iTotal = iTotal * iConstant + value;
|
||||
return this;
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the array to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(char[] array) {
|
||||
public HashCodeBuilder append(final char[] array) {
|
||||
if (array == null) {
|
||||
iTotal = iTotal * iConstant;
|
||||
} else {
|
||||
|
@ -679,7 +679,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the double to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(double value) {
|
||||
public HashCodeBuilder append(final double value) {
|
||||
return append(Double.doubleToLongBits(value));
|
||||
}
|
||||
|
||||
|
@ -692,7 +692,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the array to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(double[] array) {
|
||||
public HashCodeBuilder append(final double[] array) {
|
||||
if (array == null) {
|
||||
iTotal = iTotal * iConstant;
|
||||
} else {
|
||||
|
@ -712,7 +712,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the float to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(float value) {
|
||||
public HashCodeBuilder append(final float value) {
|
||||
iTotal = iTotal * iConstant + Float.floatToIntBits(value);
|
||||
return this;
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the array to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(float[] array) {
|
||||
public HashCodeBuilder append(final float[] array) {
|
||||
if (array == null) {
|
||||
iTotal = iTotal * iConstant;
|
||||
} else {
|
||||
|
@ -746,7 +746,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the int to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(int value) {
|
||||
public HashCodeBuilder append(final int value) {
|
||||
iTotal = iTotal * iConstant + value;
|
||||
return this;
|
||||
}
|
||||
|
@ -760,7 +760,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the array to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(int[] array) {
|
||||
public HashCodeBuilder append(final int[] array) {
|
||||
if (array == null) {
|
||||
iTotal = iTotal * iConstant;
|
||||
} else {
|
||||
|
@ -784,7 +784,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
// Long.hashCode do. Ideally we should switch to >>> at
|
||||
// some stage. There are backwards compat issues, so
|
||||
// that will have to wait for the time being. cf LANG-342.
|
||||
public HashCodeBuilder append(long value) {
|
||||
public HashCodeBuilder append(final long value) {
|
||||
iTotal = iTotal * iConstant + ((int) (value ^ (value >> 32)));
|
||||
return this;
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the array to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(long[] array) {
|
||||
public HashCodeBuilder append(final long[] array) {
|
||||
if (array == null) {
|
||||
iTotal = iTotal * iConstant;
|
||||
} else {
|
||||
|
@ -818,7 +818,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the Object to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(Object object) {
|
||||
public HashCodeBuilder append(final Object object) {
|
||||
if (object == null) {
|
||||
iTotal = iTotal * iConstant;
|
||||
|
||||
|
@ -862,7 +862,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the array to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(Object[] array) {
|
||||
public HashCodeBuilder append(final Object[] array) {
|
||||
if (array == null) {
|
||||
iTotal = iTotal * iConstant;
|
||||
} else {
|
||||
|
@ -882,7 +882,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the short to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(short value) {
|
||||
public HashCodeBuilder append(final short value) {
|
||||
iTotal = iTotal * iConstant + value;
|
||||
return this;
|
||||
}
|
||||
|
@ -896,7 +896,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* the array to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public HashCodeBuilder append(short[] array) {
|
||||
public HashCodeBuilder append(final short[] array) {
|
||||
if (array == null) {
|
||||
iTotal = iTotal * iConstant;
|
||||
} else {
|
||||
|
@ -917,7 +917,7 @@ public class HashCodeBuilder implements Builder<Integer> {
|
|||
* @return this HashCodeBuilder, used to chain calls.
|
||||
* @since 2.0
|
||||
*/
|
||||
public HashCodeBuilder appendSuper(int superHashCode) {
|
||||
public HashCodeBuilder appendSuper(final int superHashCode) {
|
||||
iTotal = iTotal * iConstant + superHashCode;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ final class IDKey {
|
|||
* Constructor for IDKey
|
||||
* @param _value The value
|
||||
*/
|
||||
public IDKey(Object _value) {
|
||||
public IDKey(final Object _value) {
|
||||
// This is the Object hashcode
|
||||
id = System.identityHashCode(_value);
|
||||
// There have been some cases (LANG-459) that return the
|
||||
|
@ -60,7 +60,7 @@ final class IDKey {
|
|||
* @return if the instances are for the same object
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(final Object other) {
|
||||
if (!(other instanceof IDKey)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @throws IllegalArgumentException
|
||||
* if the Object is <code>null</code>
|
||||
*/
|
||||
public static String toString(Object object) {
|
||||
public static String toString(final Object object) {
|
||||
return toString(object, null, false, false, null);
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @throws IllegalArgumentException
|
||||
* if the Object or <code>ToStringStyle</code> is <code>null</code>
|
||||
*/
|
||||
public static String toString(Object object, ToStringStyle style) {
|
||||
public static String toString(final Object object, final ToStringStyle style) {
|
||||
return toString(object, style, false, false, null);
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @throws IllegalArgumentException
|
||||
* if the Object is <code>null</code>
|
||||
*/
|
||||
public static String toString(Object object, ToStringStyle style, boolean outputTransients) {
|
||||
public static String toString(final Object object, final ToStringStyle style, final boolean outputTransients) {
|
||||
return toString(object, style, outputTransients, false, null);
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* if the Object is <code>null</code>
|
||||
* @since 2.1
|
||||
*/
|
||||
public static String toString(Object object, ToStringStyle style, boolean outputTransients, boolean outputStatics) {
|
||||
public static String toString(final Object object, final ToStringStyle style, final boolean outputTransients, final boolean outputStatics) {
|
||||
return toString(object, style, outputTransients, outputStatics, null);
|
||||
}
|
||||
|
||||
|
@ -277,8 +277,8 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @since 2.1
|
||||
*/
|
||||
public static <T> String toString(
|
||||
T object, ToStringStyle style, boolean outputTransients,
|
||||
boolean outputStatics, Class<? super T> reflectUpToClass) {
|
||||
final T object, final ToStringStyle style, final boolean outputTransients,
|
||||
final boolean outputStatics, final Class<? super T> reflectUpToClass) {
|
||||
return new ReflectionToStringBuilder(object, style, null, reflectUpToClass, outputTransients, outputStatics)
|
||||
.toString();
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* The field names to exclude. Null excludes nothing.
|
||||
* @return The toString value.
|
||||
*/
|
||||
public static String toStringExclude(Object object, Collection<String> excludeFieldNames) {
|
||||
public static String toStringExclude(final Object object, final Collection<String> excludeFieldNames) {
|
||||
return toStringExclude(object, toNoNullStringArray(excludeFieldNames));
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* The collection to convert
|
||||
* @return A new array of Strings.
|
||||
*/
|
||||
static String[] toNoNullStringArray(Collection<String> collection) {
|
||||
static String[] toNoNullStringArray(final Collection<String> collection) {
|
||||
if (collection == null) {
|
||||
return ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* The array to check
|
||||
* @return The given array or a new array without null.
|
||||
*/
|
||||
static String[] toNoNullStringArray(Object[] array) {
|
||||
static String[] toNoNullStringArray(final Object[] array) {
|
||||
List<String> list = new ArrayList<String>(array.length);
|
||||
for (Object e : array) {
|
||||
if (e != null) {
|
||||
|
@ -341,7 +341,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* The field names to exclude
|
||||
* @return The toString value.
|
||||
*/
|
||||
public static String toStringExclude(Object object, String... excludeFieldNames) {
|
||||
public static String toStringExclude(final Object object, final String... excludeFieldNames) {
|
||||
return new ReflectionToStringBuilder(object).setExcludeFieldNames(excludeFieldNames).toString();
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @throws IllegalArgumentException
|
||||
* if the Object passed in is <code>null</code>
|
||||
*/
|
||||
public ReflectionToStringBuilder(Object object) {
|
||||
public ReflectionToStringBuilder(final Object object) {
|
||||
super(object);
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @throws IllegalArgumentException
|
||||
* if the Object passed in is <code>null</code>
|
||||
*/
|
||||
public ReflectionToStringBuilder(Object object, ToStringStyle style) {
|
||||
public ReflectionToStringBuilder(final Object object, final ToStringStyle style) {
|
||||
super(object, style);
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @throws IllegalArgumentException
|
||||
* if the Object passed in is <code>null</code>
|
||||
*/
|
||||
public ReflectionToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer) {
|
||||
public ReflectionToStringBuilder(final Object object, final ToStringStyle style, final StringBuffer buffer) {
|
||||
super(object, style, buffer);
|
||||
}
|
||||
|
||||
|
@ -451,8 +451,8 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @since 2.1
|
||||
*/
|
||||
public <T> ReflectionToStringBuilder(
|
||||
T object, ToStringStyle style, StringBuffer buffer,
|
||||
Class<? super T> reflectUpToClass, boolean outputTransients, boolean outputStatics) {
|
||||
final T object, final ToStringStyle style, final StringBuffer buffer,
|
||||
final Class<? super T> reflectUpToClass, final boolean outputTransients, final boolean outputStatics) {
|
||||
super(object, style, buffer);
|
||||
this.setUpToClass(reflectUpToClass);
|
||||
this.setAppendTransients(outputTransients);
|
||||
|
@ -471,7 +471,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* The Field to test.
|
||||
* @return Whether or not to append the given <code>Field</code>.
|
||||
*/
|
||||
protected boolean accept(Field field) {
|
||||
protected boolean accept(final Field field) {
|
||||
if (field.getName().indexOf(ClassUtils.INNER_CLASS_SEPARATOR_CHAR) != -1) {
|
||||
// Reject field from inner class.
|
||||
return false;
|
||||
|
@ -505,7 +505,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @param clazz
|
||||
* The class of object parameter
|
||||
*/
|
||||
protected void appendFieldsIn(Class<?> clazz) {
|
||||
protected void appendFieldsIn(final Class<?> clazz) {
|
||||
if (clazz.isArray()) {
|
||||
this.reflectionAppendArray(this.getObject());
|
||||
return;
|
||||
|
@ -565,7 +565,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
*
|
||||
* @see java.lang.reflect.Field#get(Object)
|
||||
*/
|
||||
protected Object getValue(Field field) throws IllegalArgumentException, IllegalAccessException {
|
||||
protected Object getValue(final Field field) throws IllegalArgumentException, IllegalAccessException {
|
||||
return field.get(this.getObject());
|
||||
}
|
||||
|
||||
|
@ -601,7 +601,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ReflectionToStringBuilder reflectionAppendArray(Object array) {
|
||||
public ReflectionToStringBuilder reflectionAppendArray(final Object array) {
|
||||
this.getStyle().reflectionAppendArrayDetail(this.getStringBuffer(), null, array);
|
||||
return this;
|
||||
}
|
||||
|
@ -615,7 +615,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* Whether or not to append static fields.
|
||||
* @since 2.1
|
||||
*/
|
||||
public void setAppendStatics(boolean appendStatics) {
|
||||
public void setAppendStatics(final boolean appendStatics) {
|
||||
this.appendStatics = appendStatics;
|
||||
}
|
||||
|
||||
|
@ -627,7 +627,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @param appendTransients
|
||||
* Whether or not to append transient fields.
|
||||
*/
|
||||
public void setAppendTransients(boolean appendTransients) {
|
||||
public void setAppendTransients(final boolean appendTransients) {
|
||||
this.appendTransients = appendTransients;
|
||||
}
|
||||
|
||||
|
@ -638,7 +638,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* The excludeFieldNames to excluding from toString or <code>null</code>.
|
||||
* @return <code>this</code>
|
||||
*/
|
||||
public ReflectionToStringBuilder setExcludeFieldNames(String... excludeFieldNamesParam) {
|
||||
public ReflectionToStringBuilder setExcludeFieldNames(final String... excludeFieldNamesParam) {
|
||||
if (excludeFieldNamesParam == null) {
|
||||
this.excludeFieldNames = null;
|
||||
} else {
|
||||
|
@ -657,7 +657,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
|
|||
* @param clazz
|
||||
* The last super class to stop appending fields for.
|
||||
*/
|
||||
public void setUpToClass(Class<?> clazz) {
|
||||
public void setUpToClass(final Class<?> clazz) {
|
||||
if (clazz != null) {
|
||||
Object object = getObject();
|
||||
if (object != null && clazz.isInstance(object) == false) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param useClassName the new useClassName flag
|
||||
*/
|
||||
@Override
|
||||
public void setUseClassName(boolean useClassName) { // NOPMD as this is implementing the abstract class
|
||||
public void setUseClassName(final boolean useClassName) { // NOPMD as this is implementing the abstract class
|
||||
super.setUseClassName(useClassName);
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @since 2.0
|
||||
*/
|
||||
@Override
|
||||
public void setUseShortClassName(boolean useShortClassName) { // NOPMD as this is implementing the abstract class
|
||||
public void setUseShortClassName(final boolean useShortClassName) { // NOPMD as this is implementing the abstract class
|
||||
super.setUseShortClassName(useShortClassName);
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param useIdentityHashCode the new useIdentityHashCode flag
|
||||
*/
|
||||
@Override
|
||||
public void setUseIdentityHashCode(boolean useIdentityHashCode) { // NOPMD as this is implementing the abstract class
|
||||
public void setUseIdentityHashCode(final boolean useIdentityHashCode) { // NOPMD as this is implementing the abstract class
|
||||
super.setUseIdentityHashCode(useIdentityHashCode);
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param useFieldNames the new useFieldNames flag
|
||||
*/
|
||||
@Override
|
||||
public void setUseFieldNames(boolean useFieldNames) { // NOPMD as this is implementing the abstract class
|
||||
public void setUseFieldNames(final boolean useFieldNames) { // NOPMD as this is implementing the abstract class
|
||||
super.setUseFieldNames(useFieldNames);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param defaultFullDetail the new defaultFullDetail flag
|
||||
*/
|
||||
@Override
|
||||
public void setDefaultFullDetail(boolean defaultFullDetail) { // NOPMD as this is implementing the abstract class
|
||||
public void setDefaultFullDetail(final boolean defaultFullDetail) { // NOPMD as this is implementing the abstract class
|
||||
super.setDefaultFullDetail(defaultFullDetail);
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param arrayContentDetail the new arrayContentDetail flag
|
||||
*/
|
||||
@Override
|
||||
public void setArrayContentDetail(boolean arrayContentDetail) { // NOPMD as this is implementing the abstract class
|
||||
public void setArrayContentDetail(final boolean arrayContentDetail) { // NOPMD as this is implementing the abstract class
|
||||
super.setArrayContentDetail(arrayContentDetail);
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param arrayStart the new array start text
|
||||
*/
|
||||
@Override
|
||||
public void setArrayStart(String arrayStart) { // NOPMD as this is implementing the abstract class
|
||||
public void setArrayStart(final String arrayStart) { // NOPMD as this is implementing the abstract class
|
||||
super.setArrayStart(arrayStart);
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param arrayEnd the new array end text
|
||||
*/
|
||||
@Override
|
||||
public void setArrayEnd(String arrayEnd) { // NOPMD as this is implementing the abstract class
|
||||
public void setArrayEnd(final String arrayEnd) { // NOPMD as this is implementing the abstract class
|
||||
super.setArrayEnd(arrayEnd);
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param arraySeparator the new array separator text
|
||||
*/
|
||||
@Override
|
||||
public void setArraySeparator(String arraySeparator) { // NOPMD as this is implementing the abstract class
|
||||
public void setArraySeparator(final String arraySeparator) { // NOPMD as this is implementing the abstract class
|
||||
super.setArraySeparator(arraySeparator);
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param contentStart the new content start text
|
||||
*/
|
||||
@Override
|
||||
public void setContentStart(String contentStart) { // NOPMD as this is implementing the abstract class
|
||||
public void setContentStart(final String contentStart) { // NOPMD as this is implementing the abstract class
|
||||
super.setContentStart(contentStart);
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param contentEnd the new content end text
|
||||
*/
|
||||
@Override
|
||||
public void setContentEnd(String contentEnd) { // NOPMD as this is implementing the abstract class
|
||||
public void setContentEnd(final String contentEnd) { // NOPMD as this is implementing the abstract class
|
||||
super.setContentEnd(contentEnd);
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param fieldNameValueSeparator the new field name value separator text
|
||||
*/
|
||||
@Override
|
||||
public void setFieldNameValueSeparator(String fieldNameValueSeparator) { // NOPMD as this is implementing the abstract class
|
||||
public void setFieldNameValueSeparator(final String fieldNameValueSeparator) { // NOPMD as this is implementing the abstract class
|
||||
super.setFieldNameValueSeparator(fieldNameValueSeparator);
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param fieldSeparator the new field separator text
|
||||
*/
|
||||
@Override
|
||||
public void setFieldSeparator(String fieldSeparator) { // NOPMD as this is implementing the abstract class
|
||||
public void setFieldSeparator(final String fieldSeparator) { // NOPMD as this is implementing the abstract class
|
||||
super.setFieldSeparator(fieldSeparator);
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @since 2.0
|
||||
*/
|
||||
@Override
|
||||
public void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart) { // NOPMD as this is implementing the abstract class
|
||||
public void setFieldSeparatorAtStart(final boolean fieldSeparatorAtStart) { // NOPMD as this is implementing the abstract class
|
||||
super.setFieldSeparatorAtStart(fieldSeparatorAtStart);
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @since 2.0
|
||||
*/
|
||||
@Override
|
||||
public void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd) { // NOPMD as this is implementing the abstract class
|
||||
public void setFieldSeparatorAtEnd(final boolean fieldSeparatorAtEnd) { // NOPMD as this is implementing the abstract class
|
||||
super.setFieldSeparatorAtEnd(fieldSeparatorAtEnd);
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param nullText the new text to output when <code>null</code> found
|
||||
*/
|
||||
@Override
|
||||
public void setNullText(String nullText) { // NOPMD as this is implementing the abstract class
|
||||
public void setNullText(final String nullText) { // NOPMD as this is implementing the abstract class
|
||||
super.setNullText(nullText);
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param sizeStartText the new start of size text
|
||||
*/
|
||||
@Override
|
||||
public void setSizeStartText(String sizeStartText) { // NOPMD as this is implementing the abstract class
|
||||
public void setSizeStartText(final String sizeStartText) { // NOPMD as this is implementing the abstract class
|
||||
super.setSizeStartText(sizeStartText);
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param sizeEndText the new end of size text
|
||||
*/
|
||||
@Override
|
||||
public void setSizeEndText(String sizeEndText) { // NOPMD as this is implementing the abstract class
|
||||
public void setSizeEndText(final String sizeEndText) { // NOPMD as this is implementing the abstract class
|
||||
super.setSizeEndText(sizeEndText);
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param summaryObjectStartText the new start of summary text
|
||||
*/
|
||||
@Override
|
||||
public void setSummaryObjectStartText(String summaryObjectStartText) { // NOPMD as this is implementing the abstract class
|
||||
public void setSummaryObjectStartText(final String summaryObjectStartText) { // NOPMD as this is implementing the abstract class
|
||||
super.setSummaryObjectStartText(summaryObjectStartText);
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ public class StandardToStringStyle extends ToStringStyle {
|
|||
* @param summaryObjectEndText the new end of summary text
|
||||
*/
|
||||
@Override
|
||||
public void setSummaryObjectEndText(String summaryObjectEndText) { // NOPMD as this is implementing the abstract class
|
||||
public void setSummaryObjectEndText(final String summaryObjectEndText) { // NOPMD as this is implementing the abstract class
|
||||
super.setSummaryObjectEndText(summaryObjectEndText);
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param style the default <code>ToStringStyle</code>
|
||||
* @throws IllegalArgumentException if the style is <code>null</code>
|
||||
*/
|
||||
public static void setDefaultStyle(ToStringStyle style) {
|
||||
public static void setDefaultStyle(final ToStringStyle style) {
|
||||
if (style == null) {
|
||||
throw new IllegalArgumentException("The style must not be null");
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @return the String result
|
||||
* @see ReflectionToStringBuilder#toString(Object)
|
||||
*/
|
||||
public static String reflectionToString(Object object) {
|
||||
public static String reflectionToString(final Object object) {
|
||||
return ReflectionToStringBuilder.toString(object);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @return the String result
|
||||
* @see ReflectionToStringBuilder#toString(Object,ToStringStyle)
|
||||
*/
|
||||
public static String reflectionToString(Object object, ToStringStyle style) {
|
||||
public static String reflectionToString(final Object object, final ToStringStyle style) {
|
||||
return ReflectionToStringBuilder.toString(object, style);
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @return the String result
|
||||
* @see ReflectionToStringBuilder#toString(Object,ToStringStyle,boolean)
|
||||
*/
|
||||
public static String reflectionToString(Object object, ToStringStyle style, boolean outputTransients) {
|
||||
public static String reflectionToString(final Object object, final ToStringStyle style, final boolean outputTransients) {
|
||||
return ReflectionToStringBuilder.toString(object, style, outputTransients, false, null);
|
||||
}
|
||||
|
||||
|
@ -193,10 +193,10 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @since 2.0
|
||||
*/
|
||||
public static <T> String reflectionToString(
|
||||
T object,
|
||||
ToStringStyle style,
|
||||
boolean outputTransients,
|
||||
Class<? super T> reflectUpToClass) {
|
||||
final T object,
|
||||
final ToStringStyle style,
|
||||
final boolean outputTransients,
|
||||
final Class<? super T> reflectUpToClass) {
|
||||
return ReflectionToStringBuilder.toString(object, style, outputTransients, false, reflectUpToClass);
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
*
|
||||
* @param object the Object to build a <code>toString</code> for, not recommended to be null
|
||||
*/
|
||||
public ToStringBuilder(Object object) {
|
||||
public ToStringBuilder(final Object object) {
|
||||
this(object, null, null);
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param object the Object to build a <code>toString</code> for, not recommended to be null
|
||||
* @param style the style of the <code>toString</code> to create, null uses the default style
|
||||
*/
|
||||
public ToStringBuilder(Object object, ToStringStyle style) {
|
||||
public ToStringBuilder(final Object object, final ToStringStyle style) {
|
||||
this(object, style, null);
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param style the style of the <code>toString</code> to create, null uses the default style
|
||||
* @param buffer the <code>StringBuffer</code> to populate, may be null
|
||||
*/
|
||||
public ToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer) {
|
||||
public ToStringBuilder(final Object object, ToStringStyle style, StringBuffer buffer) {
|
||||
if (style == null) {
|
||||
style = getDefaultStyle();
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(boolean value) {
|
||||
public ToStringBuilder append(final boolean value) {
|
||||
style.append(buffer, null, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(boolean[] array) {
|
||||
public ToStringBuilder append(final boolean[] array) {
|
||||
style.append(buffer, null, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(byte value) {
|
||||
public ToStringBuilder append(final byte value) {
|
||||
style.append(buffer, null, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(byte[] array) {
|
||||
public ToStringBuilder append(final byte[] array) {
|
||||
style.append(buffer, null, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(char value) {
|
||||
public ToStringBuilder append(final char value) {
|
||||
style.append(buffer, null, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(char[] array) {
|
||||
public ToStringBuilder append(final char[] array) {
|
||||
style.append(buffer, null, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(double value) {
|
||||
public ToStringBuilder append(final double value) {
|
||||
style.append(buffer, null, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(double[] array) {
|
||||
public ToStringBuilder append(final double[] array) {
|
||||
style.append(buffer, null, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(float value) {
|
||||
public ToStringBuilder append(final float value) {
|
||||
style.append(buffer, null, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(float[] array) {
|
||||
public ToStringBuilder append(final float[] array) {
|
||||
style.append(buffer, null, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(int value) {
|
||||
public ToStringBuilder append(final int value) {
|
||||
style.append(buffer, null, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(int[] array) {
|
||||
public ToStringBuilder append(final int[] array) {
|
||||
style.append(buffer, null, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(long value) {
|
||||
public ToStringBuilder append(final long value) {
|
||||
style.append(buffer, null, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(long[] array) {
|
||||
public ToStringBuilder append(final long[] array) {
|
||||
style.append(buffer, null, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param obj the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(Object obj) {
|
||||
public ToStringBuilder append(final Object obj) {
|
||||
style.append(buffer, null, obj, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(Object[] array) {
|
||||
public ToStringBuilder append(final Object[] array) {
|
||||
style.append(buffer, null, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(short value) {
|
||||
public ToStringBuilder append(final short value) {
|
||||
style.append(buffer, null, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(short[] array) {
|
||||
public ToStringBuilder append(final short[] array) {
|
||||
style.append(buffer, null, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, boolean value) {
|
||||
public ToStringBuilder append(final String fieldName, final boolean value) {
|
||||
style.append(buffer, fieldName, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>hashCode</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, boolean[] array) {
|
||||
public ToStringBuilder append(final String fieldName, final boolean[] array) {
|
||||
style.append(buffer, fieldName, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* for summary info
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, boolean[] array, boolean fullDetail) {
|
||||
public ToStringBuilder append(final String fieldName, final boolean[] array, final boolean fullDetail) {
|
||||
style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
|
||||
return this;
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, byte value) {
|
||||
public ToStringBuilder append(final String fieldName, final byte value) {
|
||||
style.append(buffer, fieldName, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, byte[] array) {
|
||||
public ToStringBuilder append(final String fieldName, final byte[] array) {
|
||||
style.append(buffer, fieldName, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* for summary info
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, byte[] array, boolean fullDetail) {
|
||||
public ToStringBuilder append(final String fieldName, final byte[] array, final boolean fullDetail) {
|
||||
style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
|
||||
return this;
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, char value) {
|
||||
public ToStringBuilder append(final String fieldName, final char value) {
|
||||
style.append(buffer, fieldName, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, char[] array) {
|
||||
public ToStringBuilder append(final String fieldName, final char[] array) {
|
||||
style.append(buffer, fieldName, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* for summary info
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, char[] array, boolean fullDetail) {
|
||||
public ToStringBuilder append(final String fieldName, final char[] array, final boolean fullDetail) {
|
||||
style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
|
||||
return this;
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, double value) {
|
||||
public ToStringBuilder append(final String fieldName, final double value) {
|
||||
style.append(buffer, fieldName, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -673,7 +673,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, double[] array) {
|
||||
public ToStringBuilder append(final String fieldName, final double[] array) {
|
||||
style.append(buffer, fieldName, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -693,7 +693,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* for summary info
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, double[] array, boolean fullDetail) {
|
||||
public ToStringBuilder append(final String fieldName, final double[] array, final boolean fullDetail) {
|
||||
style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
|
||||
return this;
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, float value) {
|
||||
public ToStringBuilder append(final String fieldName, final float value) {
|
||||
style.append(buffer, fieldName, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -719,7 +719,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, float[] array) {
|
||||
public ToStringBuilder append(final String fieldName, final float[] array) {
|
||||
style.append(buffer, fieldName, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* for summary info
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, float[] array, boolean fullDetail) {
|
||||
public ToStringBuilder append(final String fieldName, final float[] array, final boolean fullDetail) {
|
||||
style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
|
||||
return this;
|
||||
}
|
||||
|
@ -752,7 +752,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, int value) {
|
||||
public ToStringBuilder append(final String fieldName, final int value) {
|
||||
style.append(buffer, fieldName, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -765,7 +765,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, int[] array) {
|
||||
public ToStringBuilder append(final String fieldName, final int[] array) {
|
||||
style.append(buffer, fieldName, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* for summary info
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, int[] array, boolean fullDetail) {
|
||||
public ToStringBuilder append(final String fieldName, final int[] array, final boolean fullDetail) {
|
||||
style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
|
||||
return this;
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, long value) {
|
||||
public ToStringBuilder append(final String fieldName, final long value) {
|
||||
style.append(buffer, fieldName, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, long[] array) {
|
||||
public ToStringBuilder append(final String fieldName, final long[] array) {
|
||||
style.append(buffer, fieldName, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -831,7 +831,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* for summary info
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, long[] array, boolean fullDetail) {
|
||||
public ToStringBuilder append(final String fieldName, final long[] array, final boolean fullDetail) {
|
||||
style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
|
||||
return this;
|
||||
}
|
||||
|
@ -844,7 +844,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param obj the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, Object obj) {
|
||||
public ToStringBuilder append(final String fieldName, final Object obj) {
|
||||
style.append(buffer, fieldName, obj, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -859,7 +859,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* <code>false</code> for summary info
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, Object obj, boolean fullDetail) {
|
||||
public ToStringBuilder append(final String fieldName, final Object obj, final boolean fullDetail) {
|
||||
style.append(buffer, fieldName, obj, Boolean.valueOf(fullDetail));
|
||||
return this;
|
||||
}
|
||||
|
@ -872,7 +872,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, Object[] array) {
|
||||
public ToStringBuilder append(final String fieldName, final Object[] array) {
|
||||
style.append(buffer, fieldName, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -892,7 +892,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* for summary info
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, Object[] array, boolean fullDetail) {
|
||||
public ToStringBuilder append(final String fieldName, final Object[] array, final boolean fullDetail) {
|
||||
style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
|
||||
return this;
|
||||
}
|
||||
|
@ -905,7 +905,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param value the value to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, short value) {
|
||||
public ToStringBuilder append(final String fieldName, final short value) {
|
||||
style.append(buffer, fieldName, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -918,7 +918,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @param array the array to add to the <code>toString</code>
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, short[] array) {
|
||||
public ToStringBuilder append(final String fieldName, final short[] array) {
|
||||
style.append(buffer, fieldName, array, null);
|
||||
return this;
|
||||
}
|
||||
|
@ -938,7 +938,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* for summary info
|
||||
* @return this
|
||||
*/
|
||||
public ToStringBuilder append(String fieldName, short[] array, boolean fullDetail) {
|
||||
public ToStringBuilder append(final String fieldName, final short[] array, final boolean fullDetail) {
|
||||
style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
|
||||
return this;
|
||||
}
|
||||
|
@ -952,7 +952,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @return this
|
||||
* @since 2.0
|
||||
*/
|
||||
public ToStringBuilder appendAsObjectToString(Object object) {
|
||||
public ToStringBuilder appendAsObjectToString(final Object object) {
|
||||
ObjectUtils.identityToString(this.getStringBuffer(), object);
|
||||
return this;
|
||||
}
|
||||
|
@ -971,7 +971,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @return this
|
||||
* @since 2.0
|
||||
*/
|
||||
public ToStringBuilder appendSuper(String superToString) {
|
||||
public ToStringBuilder appendSuper(final String superToString) {
|
||||
if (superToString != null) {
|
||||
style.appendSuper(buffer, superToString);
|
||||
}
|
||||
|
@ -1005,7 +1005,7 @@ public class ToStringBuilder implements Builder<String> {
|
|||
* @return this
|
||||
* @since 2.0
|
||||
*/
|
||||
public ToStringBuilder appendToString(String toString) {
|
||||
public ToStringBuilder appendToString(final String toString) {
|
||||
if (toString != null) {
|
||||
style.appendToString(buffer, toString);
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @return boolean <code>true</code> if the registry contains the given
|
||||
* object.
|
||||
*/
|
||||
static boolean isRegistered(Object value) {
|
||||
static boolean isRegistered(final Object value) {
|
||||
Map<Object, Object> m = getRegistry();
|
||||
return m != null && m.containsKey(value);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param value
|
||||
* The object to register.
|
||||
*/
|
||||
static void register(Object value) {
|
||||
static void register(final Object value) {
|
||||
if (value != null) {
|
||||
Map<Object, Object> m = getRegistry();
|
||||
if (m == null) {
|
||||
|
@ -204,7 +204,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param value
|
||||
* The object to unregister.
|
||||
*/
|
||||
static void unregister(Object value) {
|
||||
static void unregister(final Object value) {
|
||||
if (value != null) {
|
||||
Map<Object, Object> m = getRegistry();
|
||||
if (m != null) {
|
||||
|
@ -338,7 +338,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param superToString the <code>super.toString()</code>
|
||||
* @since 2.0
|
||||
*/
|
||||
public void appendSuper(StringBuffer buffer, String superToString) {
|
||||
public void appendSuper(final StringBuffer buffer, final String superToString) {
|
||||
appendToString(buffer, superToString);
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param toString the additional <code>toString</code>
|
||||
* @since 2.0
|
||||
*/
|
||||
public void appendToString(StringBuffer buffer, String toString) {
|
||||
public void appendToString(final StringBuffer buffer, final String toString) {
|
||||
if (toString != null) {
|
||||
int pos1 = toString.indexOf(contentStart) + contentStart.length();
|
||||
int pos2 = toString.lastIndexOf(contentEnd);
|
||||
|
@ -373,7 +373,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param buffer the <code>StringBuffer</code> to populate
|
||||
* @param object the <code>Object</code> to build a <code>toString</code> for
|
||||
*/
|
||||
public void appendStart(StringBuffer buffer, Object object) {
|
||||
public void appendStart(final StringBuffer buffer, final Object object) {
|
||||
if (object != null) {
|
||||
appendClassName(buffer, object);
|
||||
appendIdentityHashCode(buffer, object);
|
||||
|
@ -391,7 +391,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param object the <code>Object</code> to build a
|
||||
* <code>toString</code> for.
|
||||
*/
|
||||
public void appendEnd(StringBuffer buffer, Object object) {
|
||||
public void appendEnd(final StringBuffer buffer, final Object object) {
|
||||
if (this.fieldSeparatorAtEnd == false) {
|
||||
removeLastFieldSeparator(buffer);
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param buffer the <code>StringBuffer</code> to populate
|
||||
* @since 2.0
|
||||
*/
|
||||
protected void removeLastFieldSeparator(StringBuffer buffer) {
|
||||
protected void removeLastFieldSeparator(final StringBuffer buffer) {
|
||||
int len = buffer.length();
|
||||
int sepLen = fieldSeparator.length();
|
||||
if (len > 0 && sepLen > 0 && len >= sepLen) {
|
||||
|
@ -435,7 +435,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetail <code>true</code> for detail, <code>false</code>
|
||||
* for summary info, <code>null</code> for style decides
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, Object value, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final Object value, final Boolean fullDetail) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
|
||||
if (value == null) {
|
||||
|
@ -467,7 +467,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* not <code>null</code>
|
||||
* @param detail output detail or not
|
||||
*/
|
||||
protected void appendInternal(StringBuffer buffer, String fieldName, Object value, boolean detail) {
|
||||
protected void appendInternal(final StringBuffer buffer, final String fieldName, final Object value, final boolean detail) {
|
||||
if (isRegistered(value)
|
||||
&& !(value instanceof Number || value instanceof Boolean || value instanceof Character)) {
|
||||
appendCyclicObject(buffer, fieldName, value);
|
||||
|
@ -578,7 +578,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
protected void appendCyclicObject(StringBuffer buffer, String fieldName, Object value) {
|
||||
protected void appendCyclicObject(final StringBuffer buffer, final String fieldName, final Object value) {
|
||||
ObjectUtils.identityToString(buffer, value);
|
||||
}
|
||||
|
||||
|
@ -591,7 +591,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param value the value to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, Object value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) {
|
||||
buffer.append(value);
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param coll the <code>Collection</code> to add to the
|
||||
* <code>toString</code>, not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, Collection<?> coll) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final Collection<?> coll) {
|
||||
buffer.append(coll);
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param map the <code>Map</code> to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, Map<?, ?> map) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final Map<?, ?> map) {
|
||||
buffer.append(map);
|
||||
}
|
||||
|
||||
|
@ -628,7 +628,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param value the value to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendSummary(StringBuffer buffer, String fieldName, Object value) {
|
||||
protected void appendSummary(final StringBuffer buffer, final String fieldName, final Object value) {
|
||||
buffer.append(summaryObjectStartText);
|
||||
buffer.append(getShortClassName(value.getClass()));
|
||||
buffer.append(summaryObjectEndText);
|
||||
|
@ -644,7 +644,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, long value) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final long value) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
appendDetail(buffer, fieldName, value);
|
||||
appendFieldEnd(buffer, fieldName);
|
||||
|
@ -658,7 +658,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name, typically not used as already appended
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, long value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final long value) {
|
||||
buffer.append(value);
|
||||
}
|
||||
|
||||
|
@ -672,7 +672,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, int value) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final int value) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
appendDetail(buffer, fieldName, value);
|
||||
appendFieldEnd(buffer, fieldName);
|
||||
|
@ -686,7 +686,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name, typically not used as already appended
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, int value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final int value) {
|
||||
buffer.append(value);
|
||||
}
|
||||
|
||||
|
@ -700,7 +700,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, short value) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final short value) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
appendDetail(buffer, fieldName, value);
|
||||
appendFieldEnd(buffer, fieldName);
|
||||
|
@ -714,7 +714,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name, typically not used as already appended
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, short value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final short value) {
|
||||
buffer.append(value);
|
||||
}
|
||||
|
||||
|
@ -728,7 +728,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, byte value) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final byte value) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
appendDetail(buffer, fieldName, value);
|
||||
appendFieldEnd(buffer, fieldName);
|
||||
|
@ -742,7 +742,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name, typically not used as already appended
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, byte value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final byte value) {
|
||||
buffer.append(value);
|
||||
}
|
||||
|
||||
|
@ -756,7 +756,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, char value) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final char value) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
appendDetail(buffer, fieldName, value);
|
||||
appendFieldEnd(buffer, fieldName);
|
||||
|
@ -770,7 +770,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name, typically not used as already appended
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, char value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final char value) {
|
||||
buffer.append(value);
|
||||
}
|
||||
|
||||
|
@ -784,7 +784,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, double value) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final double value) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
appendDetail(buffer, fieldName, value);
|
||||
appendFieldEnd(buffer, fieldName);
|
||||
|
@ -798,7 +798,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name, typically not used as already appended
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, double value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final double value) {
|
||||
buffer.append(value);
|
||||
}
|
||||
|
||||
|
@ -812,7 +812,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, float value) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final float value) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
appendDetail(buffer, fieldName, value);
|
||||
appendFieldEnd(buffer, fieldName);
|
||||
|
@ -826,7 +826,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name, typically not used as already appended
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, float value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final float value) {
|
||||
buffer.append(value);
|
||||
}
|
||||
|
||||
|
@ -840,7 +840,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, boolean value) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final boolean value) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
appendDetail(buffer, fieldName, value);
|
||||
appendFieldEnd(buffer, fieldName);
|
||||
|
@ -854,7 +854,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name, typically not used as already appended
|
||||
* @param value the value to add to the <code>toString</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, boolean value) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final boolean value) {
|
||||
buffer.append(value);
|
||||
}
|
||||
|
||||
|
@ -868,7 +868,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetail <code>true</code> for detail, <code>false</code>
|
||||
* for summary info, <code>null</code> for style decides
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, Object[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final Object[] array, final Boolean fullDetail) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
|
||||
if (array == null) {
|
||||
|
@ -895,7 +895,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, Object[] array) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object[] array) {
|
||||
buffer.append(arrayStart);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
Object item = array[i];
|
||||
|
@ -921,7 +921,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* not <code>null</code>
|
||||
* @since 2.0
|
||||
*/
|
||||
protected void reflectionAppendArrayDetail(StringBuffer buffer, String fieldName, Object array) {
|
||||
protected void reflectionAppendArrayDetail(final StringBuffer buffer, final String fieldName, final Object array) {
|
||||
buffer.append(arrayStart);
|
||||
int length = Array.getLength(array);
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
@ -948,7 +948,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendSummary(StringBuffer buffer, String fieldName, Object[] array) {
|
||||
protected void appendSummary(final StringBuffer buffer, final String fieldName, final Object[] array) {
|
||||
appendSummarySize(buffer, fieldName, array.length);
|
||||
}
|
||||
|
||||
|
@ -964,7 +964,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetail <code>true</code> for detail, <code>false</code>
|
||||
* for summary info, <code>null</code> for style decides
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, long[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final long[] array, final Boolean fullDetail) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
|
||||
if (array == null) {
|
||||
|
@ -989,7 +989,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, long[] array) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final long[] array) {
|
||||
buffer.append(arrayStart);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i > 0) {
|
||||
|
@ -1009,7 +1009,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendSummary(StringBuffer buffer, String fieldName, long[] array) {
|
||||
protected void appendSummary(final StringBuffer buffer, final String fieldName, final long[] array) {
|
||||
appendSummarySize(buffer, fieldName, array.length);
|
||||
}
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetail <code>true</code> for detail, <code>false</code>
|
||||
* for summary info, <code>null</code> for style decides
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, int[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final int[] array, final Boolean fullDetail) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
|
||||
if (array == null) {
|
||||
|
@ -1050,7 +1050,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, int[] array) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final int[] array) {
|
||||
buffer.append(arrayStart);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i > 0) {
|
||||
|
@ -1070,7 +1070,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendSummary(StringBuffer buffer, String fieldName, int[] array) {
|
||||
protected void appendSummary(final StringBuffer buffer, final String fieldName, final int[] array) {
|
||||
appendSummarySize(buffer, fieldName, array.length);
|
||||
}
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetail <code>true</code> for detail, <code>false</code>
|
||||
* for summary info, <code>null</code> for style decides
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, short[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final short[] array, final Boolean fullDetail) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
|
||||
if (array == null) {
|
||||
|
@ -1111,7 +1111,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, short[] array) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final short[] array) {
|
||||
buffer.append(arrayStart);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i > 0) {
|
||||
|
@ -1131,7 +1131,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendSummary(StringBuffer buffer, String fieldName, short[] array) {
|
||||
protected void appendSummary(final StringBuffer buffer, final String fieldName, final short[] array) {
|
||||
appendSummarySize(buffer, fieldName, array.length);
|
||||
}
|
||||
|
||||
|
@ -1147,7 +1147,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetail <code>true</code> for detail, <code>false</code>
|
||||
* for summary info, <code>null</code> for style decides
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, byte[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final byte[] array, final Boolean fullDetail) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
|
||||
if (array == null) {
|
||||
|
@ -1172,7 +1172,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, byte[] array) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final byte[] array) {
|
||||
buffer.append(arrayStart);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i > 0) {
|
||||
|
@ -1192,7 +1192,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendSummary(StringBuffer buffer, String fieldName, byte[] array) {
|
||||
protected void appendSummary(final StringBuffer buffer, final String fieldName, final byte[] array) {
|
||||
appendSummarySize(buffer, fieldName, array.length);
|
||||
}
|
||||
|
||||
|
@ -1208,7 +1208,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetail <code>true</code> for detail, <code>false</code>
|
||||
* for summary info, <code>null</code> for style decides
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, char[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final char[] array, final Boolean fullDetail) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
|
||||
if (array == null) {
|
||||
|
@ -1233,7 +1233,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, char[] array) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final char[] array) {
|
||||
buffer.append(arrayStart);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i > 0) {
|
||||
|
@ -1253,7 +1253,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendSummary(StringBuffer buffer, String fieldName, char[] array) {
|
||||
protected void appendSummary(final StringBuffer buffer, final String fieldName, final char[] array) {
|
||||
appendSummarySize(buffer, fieldName, array.length);
|
||||
}
|
||||
|
||||
|
@ -1269,7 +1269,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetail <code>true</code> for detail, <code>false</code>
|
||||
* for summary info, <code>null</code> for style decides
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, double[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final double[] array, final Boolean fullDetail) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
|
||||
if (array == null) {
|
||||
|
@ -1294,7 +1294,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, double[] array) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final double[] array) {
|
||||
buffer.append(arrayStart);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i > 0) {
|
||||
|
@ -1314,7 +1314,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendSummary(StringBuffer buffer, String fieldName, double[] array) {
|
||||
protected void appendSummary(final StringBuffer buffer, final String fieldName, final double[] array) {
|
||||
appendSummarySize(buffer, fieldName, array.length);
|
||||
}
|
||||
|
||||
|
@ -1330,7 +1330,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetail <code>true</code> for detail, <code>false</code>
|
||||
* for summary info, <code>null</code> for style decides
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, float[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final float[] array, final Boolean fullDetail) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
|
||||
if (array == null) {
|
||||
|
@ -1355,7 +1355,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, float[] array) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final float[] array) {
|
||||
buffer.append(arrayStart);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i > 0) {
|
||||
|
@ -1375,7 +1375,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendSummary(StringBuffer buffer, String fieldName, float[] array) {
|
||||
protected void appendSummary(final StringBuffer buffer, final String fieldName, final float[] array) {
|
||||
appendSummarySize(buffer, fieldName, array.length);
|
||||
}
|
||||
|
||||
|
@ -1391,7 +1391,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetail <code>true</code> for detail, <code>false</code>
|
||||
* for summary info, <code>null</code> for style decides
|
||||
*/
|
||||
public void append(StringBuffer buffer, String fieldName, boolean[] array, Boolean fullDetail) {
|
||||
public void append(final StringBuffer buffer, final String fieldName, final boolean[] array, final Boolean fullDetail) {
|
||||
appendFieldStart(buffer, fieldName);
|
||||
|
||||
if (array == null) {
|
||||
|
@ -1416,7 +1416,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendDetail(StringBuffer buffer, String fieldName, boolean[] array) {
|
||||
protected void appendDetail(final StringBuffer buffer, final String fieldName, final boolean[] array) {
|
||||
buffer.append(arrayStart);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i > 0) {
|
||||
|
@ -1436,7 +1436,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param array the array to add to the <code>toString</code>,
|
||||
* not <code>null</code>
|
||||
*/
|
||||
protected void appendSummary(StringBuffer buffer, String fieldName, boolean[] array) {
|
||||
protected void appendSummary(final StringBuffer buffer, final String fieldName, final boolean[] array) {
|
||||
appendSummarySize(buffer, fieldName, array.length);
|
||||
}
|
||||
|
||||
|
@ -1448,7 +1448,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param buffer the <code>StringBuffer</code> to populate
|
||||
* @param object the <code>Object</code> whose name to output
|
||||
*/
|
||||
protected void appendClassName(StringBuffer buffer, Object object) {
|
||||
protected void appendClassName(final StringBuffer buffer, final Object object) {
|
||||
if (useClassName && object != null) {
|
||||
register(object);
|
||||
if (useShortClassName) {
|
||||
|
@ -1465,7 +1465,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param buffer the <code>StringBuffer</code> to populate
|
||||
* @param object the <code>Object</code> whose id to output
|
||||
*/
|
||||
protected void appendIdentityHashCode(StringBuffer buffer, Object object) {
|
||||
protected void appendIdentityHashCode(final StringBuffer buffer, final Object object) {
|
||||
if (this.isUseIdentityHashCode() && object!=null) {
|
||||
register(object);
|
||||
buffer.append('@');
|
||||
|
@ -1478,7 +1478,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
*
|
||||
* @param buffer the <code>StringBuffer</code> to populate
|
||||
*/
|
||||
protected void appendContentStart(StringBuffer buffer) {
|
||||
protected void appendContentStart(final StringBuffer buffer) {
|
||||
buffer.append(contentStart);
|
||||
}
|
||||
|
||||
|
@ -1487,7 +1487,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
*
|
||||
* @param buffer the <code>StringBuffer</code> to populate
|
||||
*/
|
||||
protected void appendContentEnd(StringBuffer buffer) {
|
||||
protected void appendContentEnd(final StringBuffer buffer) {
|
||||
buffer.append(contentEnd);
|
||||
}
|
||||
|
||||
|
@ -1499,7 +1499,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param buffer the <code>StringBuffer</code> to populate
|
||||
* @param fieldName the field name, typically not used as already appended
|
||||
*/
|
||||
protected void appendNullText(StringBuffer buffer, String fieldName) {
|
||||
protected void appendNullText(final StringBuffer buffer, final String fieldName) {
|
||||
buffer.append(nullText);
|
||||
}
|
||||
|
||||
|
@ -1508,7 +1508,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
*
|
||||
* @param buffer the <code>StringBuffer</code> to populate
|
||||
*/
|
||||
protected void appendFieldSeparator(StringBuffer buffer) {
|
||||
protected void appendFieldSeparator(final StringBuffer buffer) {
|
||||
buffer.append(fieldSeparator);
|
||||
}
|
||||
|
||||
|
@ -1518,7 +1518,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param buffer the <code>StringBuffer</code> to populate
|
||||
* @param fieldName the field name
|
||||
*/
|
||||
protected void appendFieldStart(StringBuffer buffer, String fieldName) {
|
||||
protected void appendFieldStart(final StringBuffer buffer, final String fieldName) {
|
||||
if (useFieldNames && fieldName != null) {
|
||||
buffer.append(fieldName);
|
||||
buffer.append(fieldNameValueSeparator);
|
||||
|
@ -1531,7 +1531,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param buffer the <code>StringBuffer</code> to populate
|
||||
* @param fieldName the field name, typically not used as already appended
|
||||
*/
|
||||
protected void appendFieldEnd(StringBuffer buffer, String fieldName) {
|
||||
protected void appendFieldEnd(final StringBuffer buffer, final String fieldName) {
|
||||
appendFieldSeparator(buffer);
|
||||
}
|
||||
|
||||
|
@ -1550,7 +1550,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldName the field name, typically not used as already appended
|
||||
* @param size the size to append
|
||||
*/
|
||||
protected void appendSummarySize(StringBuffer buffer, String fieldName, int size) {
|
||||
protected void appendSummarySize(final StringBuffer buffer, final String fieldName, final int size) {
|
||||
buffer.append(sizeStartText);
|
||||
buffer.append(size);
|
||||
buffer.append(sizeEndText);
|
||||
|
@ -1570,7 +1570,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fullDetailRequest the detail level requested
|
||||
* @return whether full detail is to be shown
|
||||
*/
|
||||
protected boolean isFullDetail(Boolean fullDetailRequest) {
|
||||
protected boolean isFullDetail(final Boolean fullDetailRequest) {
|
||||
if (fullDetailRequest == null) {
|
||||
return defaultFullDetail;
|
||||
}
|
||||
|
@ -1586,7 +1586,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param cls the <code>Class</code> to get the short name of
|
||||
* @return the short name
|
||||
*/
|
||||
protected String getShortClassName(Class<?> cls) {
|
||||
protected String getShortClassName(final Class<?> cls) {
|
||||
return ClassUtils.getShortClassName(cls);
|
||||
}
|
||||
|
||||
|
@ -1609,7 +1609,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
*
|
||||
* @param useClassName the new useClassName flag
|
||||
*/
|
||||
protected void setUseClassName(boolean useClassName) {
|
||||
protected void setUseClassName(final boolean useClassName) {
|
||||
this.useClassName = useClassName;
|
||||
}
|
||||
|
||||
|
@ -1631,7 +1631,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param useShortClassName the new useShortClassName flag
|
||||
* @since 2.0
|
||||
*/
|
||||
protected void setUseShortClassName(boolean useShortClassName) {
|
||||
protected void setUseShortClassName(final boolean useShortClassName) {
|
||||
this.useShortClassName = useShortClassName;
|
||||
}
|
||||
|
||||
|
@ -1651,7 +1651,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
*
|
||||
* @param useIdentityHashCode the new useIdentityHashCode flag
|
||||
*/
|
||||
protected void setUseIdentityHashCode(boolean useIdentityHashCode) {
|
||||
protected void setUseIdentityHashCode(final boolean useIdentityHashCode) {
|
||||
this.useIdentityHashCode = useIdentityHashCode;
|
||||
}
|
||||
|
||||
|
@ -1671,7 +1671,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
*
|
||||
* @param useFieldNames the new useFieldNames flag
|
||||
*/
|
||||
protected void setUseFieldNames(boolean useFieldNames) {
|
||||
protected void setUseFieldNames(final boolean useFieldNames) {
|
||||
this.useFieldNames = useFieldNames;
|
||||
}
|
||||
|
||||
|
@ -1693,7 +1693,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
*
|
||||
* @param defaultFullDetail the new defaultFullDetail flag
|
||||
*/
|
||||
protected void setDefaultFullDetail(boolean defaultFullDetail) {
|
||||
protected void setDefaultFullDetail(final boolean defaultFullDetail) {
|
||||
this.defaultFullDetail = defaultFullDetail;
|
||||
}
|
||||
|
||||
|
@ -1713,7 +1713,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
*
|
||||
* @param arrayContentDetail the new arrayContentDetail flag
|
||||
*/
|
||||
protected void setArrayContentDetail(boolean arrayContentDetail) {
|
||||
protected void setArrayContentDetail(final boolean arrayContentDetail) {
|
||||
this.arrayContentDetail = arrayContentDetail;
|
||||
}
|
||||
|
||||
|
@ -1919,7 +1919,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldSeparatorAtStart the fieldSeparatorAtStart flag
|
||||
* @since 2.0
|
||||
*/
|
||||
protected void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart) {
|
||||
protected void setFieldSeparatorAtStart(final boolean fieldSeparatorAtStart) {
|
||||
this.fieldSeparatorAtStart = fieldSeparatorAtStart;
|
||||
}
|
||||
|
||||
|
@ -1943,7 +1943,7 @@ public abstract class ToStringStyle implements Serializable {
|
|||
* @param fieldSeparatorAtEnd the fieldSeparatorAtEnd flag
|
||||
* @since 2.0
|
||||
*/
|
||||
protected void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd) {
|
||||
protected void setFieldSeparatorAtEnd(final boolean fieldSeparatorAtEnd) {
|
||||
this.fieldSeparatorAtEnd = fieldSeparatorAtEnd;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public abstract class BackgroundInitializer<T> implements
|
|||
* @param exec an external {@code ExecutorService} to be used for task
|
||||
* execution
|
||||
*/
|
||||
protected BackgroundInitializer(ExecutorService exec) {
|
||||
protected BackgroundInitializer(final ExecutorService exec) {
|
||||
setExternalExecutor(exec);
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ public abstract class BackgroundInitializer<T> implements
|
|||
* started
|
||||
*/
|
||||
public final synchronized void setExternalExecutor(
|
||||
ExecutorService externalExecutor) {
|
||||
final ExecutorService externalExecutor) {
|
||||
if (isStarted()) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot set ExecutorService after start()!");
|
||||
|
@ -287,7 +287,7 @@ public abstract class BackgroundInitializer<T> implements
|
|||
* task
|
||||
* @return a task for the background initialization
|
||||
*/
|
||||
private Callable<T> createTask(ExecutorService execDestroy) {
|
||||
private Callable<T> createTask(final ExecutorService execDestroy) {
|
||||
return new InitializationTask(execDestroy);
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ public abstract class BackgroundInitializer<T> implements
|
|||
*
|
||||
* @param exec the {@code ExecutorService}
|
||||
*/
|
||||
public InitializationTask(ExecutorService exec) {
|
||||
public InitializationTask(final ExecutorService exec) {
|
||||
execFinally = exec;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class BasicThreadFactory implements ThreadFactory {
|
|||
*
|
||||
* @param builder the {@code Builder} object
|
||||
*/
|
||||
private BasicThreadFactory(Builder builder) {
|
||||
private BasicThreadFactory(final Builder builder) {
|
||||
if (builder.wrappedFactory == null) {
|
||||
wrappedFactory = Executors.defaultThreadFactory();
|
||||
} else {
|
||||
|
@ -201,7 +201,7 @@ public class BasicThreadFactory implements ThreadFactory {
|
|||
* @return the newly created thread
|
||||
*/
|
||||
@Override
|
||||
public Thread newThread(Runnable r) {
|
||||
public Thread newThread(final Runnable r) {
|
||||
Thread t = getWrappedFactory().newThread(r);
|
||||
initializeThread(t);
|
||||
|
||||
|
@ -216,7 +216,7 @@ public class BasicThreadFactory implements ThreadFactory {
|
|||
*
|
||||
* @param t the thread to be initialized
|
||||
*/
|
||||
private void initializeThread(Thread t) {
|
||||
private void initializeThread(final Thread t) {
|
||||
|
||||
if (getNamingPattern() != null) {
|
||||
Long count = Long.valueOf(threadCounter.incrementAndGet());
|
||||
|
@ -279,7 +279,7 @@ public class BasicThreadFactory implements ThreadFactory {
|
|||
* @throws NullPointerException if the passed in {@code ThreadFactory}
|
||||
* is <b>null</b>
|
||||
*/
|
||||
public Builder wrappedFactory(ThreadFactory factory) {
|
||||
public Builder wrappedFactory(final ThreadFactory factory) {
|
||||
if (factory == null) {
|
||||
throw new NullPointerException(
|
||||
"Wrapped ThreadFactory must not be null!");
|
||||
|
@ -297,7 +297,7 @@ public class BasicThreadFactory implements ThreadFactory {
|
|||
* @return a reference to this {@code Builder}
|
||||
* @throws NullPointerException if the naming pattern is <b>null</b>
|
||||
*/
|
||||
public Builder namingPattern(String pattern) {
|
||||
public Builder namingPattern(final String pattern) {
|
||||
if (pattern == null) {
|
||||
throw new NullPointerException(
|
||||
"Naming pattern must not be null!");
|
||||
|
@ -315,7 +315,7 @@ public class BasicThreadFactory implements ThreadFactory {
|
|||
* @param f the value of the daemon flag
|
||||
* @return a reference to this {@code Builder}
|
||||
*/
|
||||
public Builder daemon(boolean f) {
|
||||
public Builder daemon(final boolean f) {
|
||||
daemonFlag = Boolean.valueOf(f);
|
||||
return this;
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ public class BasicThreadFactory implements ThreadFactory {
|
|||
* @param prio the priority
|
||||
* @return a reference to this {@code Builder}
|
||||
*/
|
||||
public Builder priority(int prio) {
|
||||
public Builder priority(final int prio) {
|
||||
priority = Integer.valueOf(prio);
|
||||
return this;
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ public class BasicThreadFactory implements ThreadFactory {
|
|||
* @throws NullPointerException if the exception handler is <b>null</b>
|
||||
*/
|
||||
public Builder uncaughtExceptionHandler(
|
||||
Thread.UncaughtExceptionHandler handler) {
|
||||
final Thread.UncaughtExceptionHandler handler) {
|
||||
if (handler == null) {
|
||||
throw new NullPointerException(
|
||||
"Uncaught exception handler must not be null!");
|
||||
|
|
|
@ -76,7 +76,7 @@ public class CallableBackgroundInitializer<T> extends BackgroundInitializer<T> {
|
|||
* @param call the {@code Callable} (must not be <b>null</b>)
|
||||
* @throws IllegalArgumentException if the {@code Callable} is <b>null</b>
|
||||
*/
|
||||
public CallableBackgroundInitializer(Callable<T> call) {
|
||||
public CallableBackgroundInitializer(final Callable<T> call) {
|
||||
checkCallable(call);
|
||||
callable = call;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class CallableBackgroundInitializer<T> extends BackgroundInitializer<T> {
|
|||
* execution
|
||||
* @throws IllegalArgumentException if the {@code Callable} is <b>null</b>
|
||||
*/
|
||||
public CallableBackgroundInitializer(Callable<T> call, ExecutorService exec) {
|
||||
public CallableBackgroundInitializer(final Callable<T> call, final ExecutorService exec) {
|
||||
super(exec);
|
||||
checkCallable(call);
|
||||
callable = call;
|
||||
|
@ -118,7 +118,7 @@ public class CallableBackgroundInitializer<T> extends BackgroundInitializer<T> {
|
|||
* @param call the object to check
|
||||
* @throws IllegalArgumentException if the {@code Callable} is <b>null</b>
|
||||
*/
|
||||
private void checkCallable(Callable<T> call) {
|
||||
private void checkCallable(final Callable<T> call) {
|
||||
if (call == null) {
|
||||
throw new IllegalArgumentException("Callable must not be null!");
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ConcurrentException extends Exception {
|
|||
* @param cause the cause of this exception
|
||||
* @throws IllegalArgumentException if the cause is not a checked exception
|
||||
*/
|
||||
public ConcurrentException(Throwable cause) {
|
||||
public ConcurrentException(final Throwable cause) {
|
||||
super(ConcurrentUtils.checkedException(cause));
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class ConcurrentException extends Exception {
|
|||
* @param cause the cause of this exception
|
||||
* @throws IllegalArgumentException if the cause is not a checked exception
|
||||
*/
|
||||
public ConcurrentException(String msg, Throwable cause) {
|
||||
public ConcurrentException(final String msg, final Throwable cause) {
|
||||
super(msg, ConcurrentUtils.checkedException(cause));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ConcurrentRuntimeException extends RuntimeException {
|
|||
* @param cause the cause of this exception
|
||||
* @throws IllegalArgumentException if the cause is not a checked exception
|
||||
*/
|
||||
public ConcurrentRuntimeException(Throwable cause) {
|
||||
public ConcurrentRuntimeException(final Throwable cause) {
|
||||
super(ConcurrentUtils.checkedException(cause));
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class ConcurrentRuntimeException extends RuntimeException {
|
|||
* @param cause the cause of this exception
|
||||
* @throws IllegalArgumentException if the cause is not a checked exception
|
||||
*/
|
||||
public ConcurrentRuntimeException(String msg, Throwable cause) {
|
||||
public ConcurrentRuntimeException(final String msg, final Throwable cause) {
|
||||
super(msg, ConcurrentUtils.checkedException(cause));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ConcurrentUtils {
|
|||
* @param ex the exception to be processed
|
||||
* @return a {@code ConcurrentException} with the checked cause
|
||||
*/
|
||||
public static ConcurrentException extractCause(ExecutionException ex) {
|
||||
public static ConcurrentException extractCause(final ExecutionException ex) {
|
||||
if (ex == null || ex.getCause() == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class ConcurrentUtils {
|
|||
* @return a {@code ConcurrentRuntimeException} with the checked cause
|
||||
*/
|
||||
public static ConcurrentRuntimeException extractCauseUnchecked(
|
||||
ExecutionException ex) {
|
||||
final ExecutionException ex) {
|
||||
if (ex == null || ex.getCause() == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class ConcurrentUtils {
|
|||
* @throws ConcurrentException if the cause of the {@code
|
||||
* ExecutionException} is a checked exception
|
||||
*/
|
||||
public static void handleCause(ExecutionException ex)
|
||||
public static void handleCause(final ExecutionException ex)
|
||||
throws ConcurrentException {
|
||||
ConcurrentException cex = extractCause(ex);
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class ConcurrentUtils {
|
|||
* ExecutionException} is a checked exception; this exception is then
|
||||
* wrapped in the thrown runtime exception
|
||||
*/
|
||||
public static void handleCauseUnchecked(ExecutionException ex) {
|
||||
public static void handleCauseUnchecked(final ExecutionException ex) {
|
||||
ConcurrentRuntimeException crex = extractCauseUnchecked(ex);
|
||||
|
||||
if (crex != null) {
|
||||
|
@ -140,7 +140,7 @@ public class ConcurrentUtils {
|
|||
* @throws IllegalArgumentException if the {@code Throwable} is not a
|
||||
* checked exception
|
||||
*/
|
||||
static Throwable checkedException(Throwable ex) {
|
||||
static Throwable checkedException(final Throwable ex) {
|
||||
if (ex != null && !(ex instanceof RuntimeException)
|
||||
&& !(ex instanceof Error)) {
|
||||
return ex;
|
||||
|
@ -155,7 +155,7 @@ public class ConcurrentUtils {
|
|||
*
|
||||
* @param ex the exception in question
|
||||
*/
|
||||
private static void throwCause(ExecutionException ex) {
|
||||
private static void throwCause(final ExecutionException ex) {
|
||||
if (ex.getCause() instanceof RuntimeException) {
|
||||
throw (RuntimeException) ex.getCause();
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class ConcurrentUtils {
|
|||
* @throws ConcurrentException if the {@code ConcurrentInitializer} throws
|
||||
* an exception
|
||||
*/
|
||||
public static <T> T initialize(ConcurrentInitializer<T> initializer)
|
||||
public static <T> T initialize(final ConcurrentInitializer<T> initializer)
|
||||
throws ConcurrentException {
|
||||
return initializer != null ? initializer.get() : null;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ public class ConcurrentUtils {
|
|||
* @return the object managed by the {@code ConcurrentInitializer}
|
||||
* @throws ConcurrentRuntimeException if the initializer throws an exception
|
||||
*/
|
||||
public static <T> T initializeUnchecked(ConcurrentInitializer<T> initializer) {
|
||||
public static <T> T initializeUnchecked(final ConcurrentInitializer<T> initializer) {
|
||||
try {
|
||||
return initialize(initializer);
|
||||
} catch (ConcurrentException cex) {
|
||||
|
@ -238,7 +238,7 @@ public class ConcurrentUtils {
|
|||
* @param value the value to be added
|
||||
* @return the value stored in the map after this operation
|
||||
*/
|
||||
public static <K, V> V putIfAbsent(ConcurrentMap<K, V> map, K key, V value) {
|
||||
public static <K, V> V putIfAbsent(final ConcurrentMap<K, V> map, final K key, final V value) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -267,8 +267,8 @@ public class ConcurrentUtils {
|
|||
* not be the object created by the {@link ConcurrentInitializer}
|
||||
* @throws ConcurrentException if the initializer throws an exception
|
||||
*/
|
||||
public static <K, V> V createIfAbsent(ConcurrentMap<K, V> map, K key,
|
||||
ConcurrentInitializer<V> init) throws ConcurrentException {
|
||||
public static <K, V> V createIfAbsent(final ConcurrentMap<K, V> map, final K key,
|
||||
final ConcurrentInitializer<V> init) throws ConcurrentException {
|
||||
if (map == null || init == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -295,8 +295,8 @@ public class ConcurrentUtils {
|
|||
* not be the object created by the {@link ConcurrentInitializer}
|
||||
* @throws ConcurrentRuntimeException if the initializer throws an exception
|
||||
*/
|
||||
public static <K, V> V createIfAbsentUnchecked(ConcurrentMap<K, V> map,
|
||||
K key, ConcurrentInitializer<V> init) {
|
||||
public static <K, V> V createIfAbsentUnchecked(final ConcurrentMap<K, V> map,
|
||||
final K key, final ConcurrentInitializer<V> init) {
|
||||
try {
|
||||
return createIfAbsent(map, key, init);
|
||||
} catch (ConcurrentException cex) {
|
||||
|
@ -320,7 +320,7 @@ public class ConcurrentUtils {
|
|||
* @param value the constant value to return, may be null
|
||||
* @return an instance of Future that will return the value, never null
|
||||
*/
|
||||
public static <T> Future<T> constantFuture(T value) {
|
||||
public static <T> Future<T> constantFuture(final T value) {
|
||||
return new ConstantFuture<T>(value);
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ public class ConcurrentUtils {
|
|||
*
|
||||
* @param value the value (may be <b>null</b>)
|
||||
*/
|
||||
ConstantFuture(T value) {
|
||||
ConstantFuture(final T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ public class ConcurrentUtils {
|
|||
* does not block, therefore the timeout has no meaning.
|
||||
*/
|
||||
@Override
|
||||
public T get(long timeout, TimeUnit unit) {
|
||||
public T get(final long timeout, final TimeUnit unit) {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -383,7 +383,7 @@ public class ConcurrentUtils {
|
|||
* implementation always returns <b>false</b>.
|
||||
*/
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
public boolean cancel(final boolean mayInterruptIfRunning) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ConstantInitializer<T> implements ConcurrentInitializer<T> {
|
|||
*
|
||||
* @param obj the object to be managed by this initializer
|
||||
*/
|
||||
public ConstantInitializer(T obj) {
|
||||
public ConstantInitializer(final T obj) {
|
||||
object = obj;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class ConstantInitializer<T> implements ConcurrentInitializer<T> {
|
|||
* @return a flag whether the objects are equal
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public class MultiBackgroundInitializer
|
|||
* @param exec the {@code ExecutorService} for executing the background
|
||||
* tasks
|
||||
*/
|
||||
public MultiBackgroundInitializer(ExecutorService exec) {
|
||||
public MultiBackgroundInitializer(final ExecutorService exec) {
|
||||
super(exec);
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class MultiBackgroundInitializer
|
|||
* @throws IllegalArgumentException if a required parameter is missing
|
||||
* @throws IllegalStateException if {@code start()} has already been called
|
||||
*/
|
||||
public void addInitializer(String name, BackgroundInitializer<?> init) {
|
||||
public void addInitializer(final String name, final BackgroundInitializer<?> init) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Name of child initializer must not be null!");
|
||||
|
@ -244,9 +244,9 @@ public class MultiBackgroundInitializer
|
|||
* @param excepts the exceptions
|
||||
*/
|
||||
private MultiBackgroundInitializerResults(
|
||||
Map<String, BackgroundInitializer<?>> inits,
|
||||
Map<String, Object> results,
|
||||
Map<String, ConcurrentException> excepts) {
|
||||
final Map<String, BackgroundInitializer<?>> inits,
|
||||
final Map<String, Object> results,
|
||||
final Map<String, ConcurrentException> excepts) {
|
||||
initializers = inits;
|
||||
resultObjects = results;
|
||||
exceptions = excepts;
|
||||
|
@ -260,7 +260,7 @@ public class MultiBackgroundInitializer
|
|||
* @return the {@code BackgroundInitializer} with this name
|
||||
* @throws NoSuchElementException if the name cannot be resolved
|
||||
*/
|
||||
public BackgroundInitializer<?> getInitializer(String name) {
|
||||
public BackgroundInitializer<?> getInitializer(final String name) {
|
||||
return checkName(name);
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ public class MultiBackgroundInitializer
|
|||
* BackgroundInitializer}
|
||||
* @throws NoSuchElementException if the name cannot be resolved
|
||||
*/
|
||||
public Object getResultObject(String name) {
|
||||
public Object getResultObject(final String name) {
|
||||
checkName(name);
|
||||
return resultObjects.get(name);
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ public class MultiBackgroundInitializer
|
|||
* @return a flag whether this initializer caused an exception
|
||||
* @throws NoSuchElementException if the name cannot be resolved
|
||||
*/
|
||||
public boolean isException(String name) {
|
||||
public boolean isException(final String name) {
|
||||
checkName(name);
|
||||
return exceptions.containsKey(name);
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ public class MultiBackgroundInitializer
|
|||
* @return the exception thrown by this initializer
|
||||
* @throws NoSuchElementException if the name cannot be resolved
|
||||
*/
|
||||
public ConcurrentException getException(String name) {
|
||||
public ConcurrentException getException(final String name) {
|
||||
checkName(name);
|
||||
return exceptions.get(name);
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ public class MultiBackgroundInitializer
|
|||
* @return the initializer with this name
|
||||
* @throws NoSuchElementException if the name is unknown
|
||||
*/
|
||||
private BackgroundInitializer<?> checkName(String name) {
|
||||
private BackgroundInitializer<?> checkName(final String name) {
|
||||
BackgroundInitializer<?> init = initializers.get(name);
|
||||
if (init == null) {
|
||||
throw new NoSuchElementException(
|
||||
|
|
|
@ -181,7 +181,7 @@ public class TimedSemaphore {
|
|||
* @param limit the limit for the semaphore
|
||||
* @throws IllegalArgumentException if the period is less or equals 0
|
||||
*/
|
||||
public TimedSemaphore(long timePeriod, TimeUnit timeUnit, int limit) {
|
||||
public TimedSemaphore(final long timePeriod, final TimeUnit timeUnit, final int limit) {
|
||||
this(null, timePeriod, timeUnit, limit);
|
||||
}
|
||||
|
||||
|
@ -197,8 +197,8 @@ public class TimedSemaphore {
|
|||
* @param limit the limit for the semaphore
|
||||
* @throws IllegalArgumentException if the period is less or equals 0
|
||||
*/
|
||||
public TimedSemaphore(ScheduledExecutorService service, long timePeriod,
|
||||
TimeUnit timeUnit, int limit) {
|
||||
public TimedSemaphore(final ScheduledExecutorService service, final long timePeriod,
|
||||
final TimeUnit timeUnit, final int limit) {
|
||||
if (timePeriod <= 0) {
|
||||
throw new IllegalArgumentException("Time period must be greater 0!");
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public class TimedSemaphore {
|
|||
*
|
||||
* @param limit the limit
|
||||
*/
|
||||
public final synchronized void setLimit(int limit) {
|
||||
public final synchronized void setLimit(final int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @throws IllegalArgumentException if <code>listenerInterface</code> is
|
||||
* not an interface.
|
||||
*/
|
||||
public static <T> EventListenerSupport<T> create(Class<T> listenerInterface) {
|
||||
public static <T> EventListenerSupport<T> create(final Class<T> listenerInterface) {
|
||||
return new EventListenerSupport<T>(listenerInterface);
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @throws IllegalArgumentException if <code>listenerInterface</code> is
|
||||
* not an interface.
|
||||
*/
|
||||
public EventListenerSupport(Class<L> listenerInterface) {
|
||||
public EventListenerSupport(final Class<L> listenerInterface) {
|
||||
this(listenerInterface, Thread.currentThread().getContextClassLoader());
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @throws IllegalArgumentException if <code>listenerInterface</code> is
|
||||
* not an interface.
|
||||
*/
|
||||
public EventListenerSupport(Class<L> listenerInterface, ClassLoader classLoader) {
|
||||
public EventListenerSupport(final Class<L> listenerInterface, final ClassLoader classLoader) {
|
||||
this();
|
||||
Validate.notNull(listenerInterface, "Listener interface cannot be null.");
|
||||
Validate.notNull(classLoader, "ClassLoader cannot be null.");
|
||||
|
@ -175,7 +175,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @throws NullPointerException if <code>listener</code> is
|
||||
* <code>null</code>.
|
||||
*/
|
||||
public void addListener(L listener) {
|
||||
public void addListener(final L listener) {
|
||||
Validate.notNull(listener, "Listener object cannot be null.");
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @throws NullPointerException if <code>listener</code> is
|
||||
* <code>null</code>.
|
||||
*/
|
||||
public void removeListener(L listener) {
|
||||
public void removeListener(final L listener) {
|
||||
Validate.notNull(listener, "Listener object cannot be null.");
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @param objectOutputStream the output stream
|
||||
* @throws IOException if an IO error occurs
|
||||
*/
|
||||
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
|
||||
private void writeObject(final ObjectOutputStream objectOutputStream) throws IOException {
|
||||
ArrayList<L> serializableListeners = new ArrayList<L>();
|
||||
|
||||
// don't just rely on instanceof Serializable:
|
||||
|
@ -244,7 +244,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @throws IOException if an IO error occurs
|
||||
* @throws ClassNotFoundException if the class cannot be resolved
|
||||
*/
|
||||
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
||||
private void readObject(final ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
||||
@SuppressWarnings("unchecked") // Will throw CCE here if not correct
|
||||
L[] listeners = (L[]) objectInputStream.readObject();
|
||||
|
||||
|
@ -261,7 +261,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @param listenerInterface the class of the listener interface
|
||||
* @param classLoader the class loader to be used
|
||||
*/
|
||||
private void initializeTransientFields(Class<L> listenerInterface, ClassLoader classLoader) {
|
||||
private void initializeTransientFields(final Class<L> listenerInterface, final ClassLoader classLoader) {
|
||||
@SuppressWarnings("unchecked") // Will throw CCE here if not correct
|
||||
L[] array = (L[]) Array.newInstance(listenerInterface, 0);
|
||||
this.prototypeArray = array;
|
||||
|
@ -273,7 +273,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @param listenerInterface the class of the listener interface
|
||||
* @param classLoader the class loader to be used
|
||||
*/
|
||||
private void createProxy(Class<L> listenerInterface, ClassLoader classLoader) {
|
||||
private void createProxy(final Class<L> listenerInterface, final ClassLoader classLoader) {
|
||||
proxy = listenerInterface.cast(Proxy.newProxyInstance(classLoader,
|
||||
new Class[] { listenerInterface }, createInvocationHandler()));
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ public class EventListenerSupport<L> implements Serializable {
|
|||
* @throws Throwable if an error occurs
|
||||
*/
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
|
||||
for (L listener : listeners) {
|
||||
method.invoke(listener, args);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class EventUtils {
|
|||
*
|
||||
* @throws IllegalArgumentException if the object doesn't support the listener type
|
||||
*/
|
||||
public static <L> void addEventListener(Object eventSource, Class<L> listenerType, L listener) {
|
||||
public static <L> void addEventListener(final Object eventSource, final Class<L> listenerType, final L listener) {
|
||||
try {
|
||||
MethodUtils.invokeMethod(eventSource, "add" + listenerType.getSimpleName(), listener);
|
||||
} catch (NoSuchMethodException e) {
|
||||
|
@ -72,8 +72,8 @@ public class EventUtils {
|
|||
* @param eventTypes the event types (method names) from the listener interface (if none specified, all will be
|
||||
* supported)
|
||||
*/
|
||||
public static <L> void bindEventsToMethod(Object target, String methodName, Object eventSource,
|
||||
Class<L> listenerType, String... eventTypes) {
|
||||
public static <L> void bindEventsToMethod(final Object target, final String methodName, final Object eventSource,
|
||||
final Class<L> listenerType, final String... eventTypes) {
|
||||
final L listener = listenerType.cast(Proxy.newProxyInstance(target.getClass().getClassLoader(),
|
||||
new Class[] { listenerType }, new EventBindingInvocationHandler(target, methodName, eventTypes)));
|
||||
addEventListener(eventSource, listenerType, listener);
|
||||
|
@ -91,7 +91,7 @@ public class EventUtils {
|
|||
* @param methodName the name of the method to be invoked
|
||||
* @param eventTypes the names of the supported event types
|
||||
*/
|
||||
EventBindingInvocationHandler(final Object target, final String methodName, String[] eventTypes) {
|
||||
EventBindingInvocationHandler(final Object target, final String methodName, final String[] eventTypes) {
|
||||
this.target = target;
|
||||
this.methodName = methodName;
|
||||
this.eventTypes = new HashSet<String>(Arrays.asList(eventTypes));
|
||||
|
|
|
@ -105,7 +105,7 @@ public class ContextedException extends Exception implements ExceptionContext {
|
|||
*
|
||||
* @param message the exception message, may be null
|
||||
*/
|
||||
public ContextedException(String message) {
|
||||
public ContextedException(final String message) {
|
||||
super(message);
|
||||
exceptionContext = new DefaultExceptionContext();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class ContextedException extends Exception implements ExceptionContext {
|
|||
*
|
||||
* @param cause the underlying cause of the exception, may be null
|
||||
*/
|
||||
public ContextedException(Throwable cause) {
|
||||
public ContextedException(final Throwable cause) {
|
||||
super(cause);
|
||||
exceptionContext = new DefaultExceptionContext();
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class ContextedException extends Exception implements ExceptionContext {
|
|||
* @param message the exception message, may be null
|
||||
* @param cause the underlying cause of the exception, may be null
|
||||
*/
|
||||
public ContextedException(String message, Throwable cause) {
|
||||
public ContextedException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
exceptionContext = new DefaultExceptionContext();
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class ContextedException extends Exception implements ExceptionContext {
|
|||
* @param cause the underlying cause of the exception, may be null
|
||||
* @param context the context used to store the additional information, null uses default implementation
|
||||
*/
|
||||
public ContextedException(String message, Throwable cause, ExceptionContext context) {
|
||||
public ContextedException(final String message, final Throwable cause, ExceptionContext context) {
|
||||
super(message, cause);
|
||||
if (context == null) {
|
||||
context = new DefaultExceptionContext();
|
||||
|
@ -165,7 +165,7 @@ public class ContextedException extends Exception implements ExceptionContext {
|
|||
* @return {@code this}, for method chaining, not {@code null}
|
||||
*/
|
||||
@Override
|
||||
public ContextedException addContextValue(String label, Object value) {
|
||||
public ContextedException addContextValue(final String label, final Object value) {
|
||||
exceptionContext.addContextValue(label, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class ContextedException extends Exception implements ExceptionContext {
|
|||
* @return {@code this}, for method chaining, not {@code null}
|
||||
*/
|
||||
@Override
|
||||
public ContextedException setContextValue(String label, Object value) {
|
||||
public ContextedException setContextValue(final String label, final Object value) {
|
||||
exceptionContext.setContextValue(label, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ public class ContextedException extends Exception implements ExceptionContext {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<Object> getContextValues(String label) {
|
||||
public List<Object> getContextValues(final String label) {
|
||||
return this.exceptionContext.getContextValues(label);
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ public class ContextedException extends Exception implements ExceptionContext {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Object getFirstContextValue(String label) {
|
||||
public Object getFirstContextValue(final String label) {
|
||||
return this.exceptionContext.getFirstContextValue(label);
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ public class ContextedException extends Exception implements ExceptionContext {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getFormattedExceptionMessage(String baseMessage) {
|
||||
public String getFormattedExceptionMessage(final String baseMessage) {
|
||||
return exceptionContext.getFormattedExceptionMessage(baseMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
|
|||
*
|
||||
* @param message the exception message, may be null
|
||||
*/
|
||||
public ContextedRuntimeException(String message) {
|
||||
public ContextedRuntimeException(final String message) {
|
||||
super(message);
|
||||
exceptionContext = new DefaultExceptionContext();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
|
|||
*
|
||||
* @param cause the underlying cause of the exception, may be null
|
||||
*/
|
||||
public ContextedRuntimeException(Throwable cause) {
|
||||
public ContextedRuntimeException(final Throwable cause) {
|
||||
super(cause);
|
||||
exceptionContext = new DefaultExceptionContext();
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
|
|||
* @param message the exception message, may be null
|
||||
* @param cause the underlying cause of the exception, may be null
|
||||
*/
|
||||
public ContextedRuntimeException(String message, Throwable cause) {
|
||||
public ContextedRuntimeException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
exceptionContext = new DefaultExceptionContext();
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
|
|||
* @param cause the underlying cause of the exception, may be null
|
||||
* @param context the context used to store the additional information, null uses default implementation
|
||||
*/
|
||||
public ContextedRuntimeException(String message, Throwable cause, ExceptionContext context) {
|
||||
public ContextedRuntimeException(final String message, final Throwable cause, ExceptionContext context) {
|
||||
super(message, cause);
|
||||
if (context == null) {
|
||||
context = new DefaultExceptionContext();
|
||||
|
@ -165,7 +165,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
|
|||
* @return {@code this}, for method chaining, not {@code null}
|
||||
*/
|
||||
@Override
|
||||
public ContextedRuntimeException addContextValue(String label, Object value) {
|
||||
public ContextedRuntimeException addContextValue(final String label, final Object value) {
|
||||
exceptionContext.addContextValue(label, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
|
|||
* @return {@code this}, for method chaining, not {@code null}
|
||||
*/
|
||||
@Override
|
||||
public ContextedRuntimeException setContextValue(String label, Object value) {
|
||||
public ContextedRuntimeException setContextValue(final String label, final Object value) {
|
||||
exceptionContext.setContextValue(label, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<Object> getContextValues(String label) {
|
||||
public List<Object> getContextValues(final String label) {
|
||||
return this.exceptionContext.getContextValues(label);
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Object getFirstContextValue(String label) {
|
||||
public Object getFirstContextValue(final String label) {
|
||||
return this.exceptionContext.getFirstContextValue(label);
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ public class ContextedRuntimeException extends RuntimeException implements Excep
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getFormattedExceptionMessage(String baseMessage) {
|
||||
public String getFormattedExceptionMessage(final String baseMessage) {
|
||||
return exceptionContext.getFormattedExceptionMessage(baseMessage);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public DefaultExceptionContext addContextValue(String label, Object value) {
|
||||
public DefaultExceptionContext addContextValue(final String label, final Object value) {
|
||||
contextValues.add(new ImmutablePair<String, Object>(label, value));
|
||||
return this;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public DefaultExceptionContext setContextValue(String label, Object value) {
|
||||
public DefaultExceptionContext setContextValue(final String label, final Object value) {
|
||||
for (final Iterator<Pair<String, Object>> iter = contextValues.iterator(); iter.hasNext();) {
|
||||
final Pair<String, Object> p = iter.next();
|
||||
if (StringUtils.equals(label, p.getKey())) {
|
||||
|
@ -74,7 +74,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<Object> getContextValues(String label) {
|
||||
public List<Object> getContextValues(final String label) {
|
||||
final List<Object> values = new ArrayList<Object>();
|
||||
for (final Pair<String, Object> pair : contextValues) {
|
||||
if (StringUtils.equals(label, pair.getKey())) {
|
||||
|
@ -88,7 +88,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Object getFirstContextValue(String label) {
|
||||
public Object getFirstContextValue(final String label) {
|
||||
for (final Pair<String, Object> pair : contextValues) {
|
||||
if (StringUtils.equals(label, pair.getKey())) {
|
||||
return pair.getValue();
|
||||
|
@ -124,7 +124,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable {
|
|||
* @return the exception message <b>with</b> context information appended, never null
|
||||
*/
|
||||
@Override
|
||||
public String getFormattedExceptionMessage(String baseMessage){
|
||||
public String getFormattedExceptionMessage(final String baseMessage){
|
||||
StringBuilder buffer = new StringBuilder(256);
|
||||
if (baseMessage != null) {
|
||||
buffer.append(baseMessage);
|
||||
|
|
|
@ -120,7 +120,7 @@ public class ExceptionUtils {
|
|||
* @deprecated This feature will be removed in Lang 4.0
|
||||
*/
|
||||
@Deprecated
|
||||
public static Throwable getCause(Throwable throwable) {
|
||||
public static Throwable getCause(final Throwable throwable) {
|
||||
return getCause(throwable, CAUSE_METHOD_NAMES);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class ExceptionUtils {
|
|||
* @deprecated This feature will be removed in Lang 4.0
|
||||
*/
|
||||
@Deprecated
|
||||
public static Throwable getCause(Throwable throwable, String[] methodNames) {
|
||||
public static Throwable getCause(final Throwable throwable, String[] methodNames) {
|
||||
if (throwable == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public class ExceptionUtils {
|
|||
* @return the root cause of the <code>Throwable</code>,
|
||||
* <code>null</code> if none found or null throwable input
|
||||
*/
|
||||
public static Throwable getRootCause(Throwable throwable) {
|
||||
public static Throwable getRootCause(final Throwable throwable) {
|
||||
List<Throwable> list = getThrowableList(throwable);
|
||||
return list.size() < 2 ? null : (Throwable)list.get(list.size() - 1);
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ public class ExceptionUtils {
|
|||
* @return the wrapped exception, or <code>null</code> if not found
|
||||
*/
|
||||
// TODO: Remove in Lang 4.0
|
||||
private static Throwable getCauseUsingMethodName(Throwable throwable, String methodName) {
|
||||
private static Throwable getCauseUsingMethodName(final Throwable throwable, final String methodName) {
|
||||
Method method = null;
|
||||
try {
|
||||
method = throwable.getClass().getMethod(methodName);
|
||||
|
@ -230,7 +230,7 @@ public class ExceptionUtils {
|
|||
* @param throwable the throwable to inspect, may be null
|
||||
* @return the count of throwables, zero if null input
|
||||
*/
|
||||
public static int getThrowableCount(Throwable throwable) {
|
||||
public static int getThrowableCount(final Throwable throwable) {
|
||||
return getThrowableList(throwable).size();
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ public class ExceptionUtils {
|
|||
* @param throwable the throwable to inspect, may be null
|
||||
* @return the array of throwables, never null
|
||||
*/
|
||||
public static Throwable[] getThrowables(Throwable throwable) {
|
||||
public static Throwable[] getThrowables(final Throwable throwable) {
|
||||
List<Throwable> list = getThrowableList(throwable);
|
||||
return list.toArray(new Throwable[list.size()]);
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ public class ExceptionUtils {
|
|||
* @param clazz the class to search for, subclasses do not match, null returns -1
|
||||
* @return the index into the throwable chain, -1 if no match or null input
|
||||
*/
|
||||
public static int indexOfThrowable(Throwable throwable, Class<?> clazz) {
|
||||
public static int indexOfThrowable(final Throwable throwable, final Class<?> clazz) {
|
||||
return indexOf(throwable, clazz, 0, false);
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ public class ExceptionUtils {
|
|||
* negative treated as zero, larger than chain size returns -1
|
||||
* @return the index into the throwable chain, -1 if no match or null input
|
||||
*/
|
||||
public static int indexOfThrowable(Throwable throwable, Class<?> clazz, int fromIndex) {
|
||||
public static int indexOfThrowable(final Throwable throwable, final Class<?> clazz, final int fromIndex) {
|
||||
return indexOf(throwable, clazz, fromIndex, false);
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ public class ExceptionUtils {
|
|||
* @return the index into the throwable chain, -1 if no match or null input
|
||||
* @since 2.1
|
||||
*/
|
||||
public static int indexOfType(Throwable throwable, Class<?> type) {
|
||||
public static int indexOfType(final Throwable throwable, final Class<?> type) {
|
||||
return indexOf(throwable, type, 0, true);
|
||||
}
|
||||
|
||||
|
@ -368,7 +368,7 @@ public class ExceptionUtils {
|
|||
* @return the index into the throwable chain, -1 if no match or null input
|
||||
* @since 2.1
|
||||
*/
|
||||
public static int indexOfType(Throwable throwable, Class<?> type, int fromIndex) {
|
||||
public static int indexOfType(final Throwable throwable, final Class<?> type, final int fromIndex) {
|
||||
return indexOf(throwable, type, fromIndex, true);
|
||||
}
|
||||
|
||||
|
@ -383,7 +383,7 @@ public class ExceptionUtils {
|
|||
* using references
|
||||
* @return index of the <code>type</code> within throwables nested within the specified <code>throwable</code>
|
||||
*/
|
||||
private static int indexOf(Throwable throwable, Class<?> type, int fromIndex, boolean subclass) {
|
||||
private static int indexOf(final Throwable throwable, final Class<?> type, int fromIndex, final boolean subclass) {
|
||||
if (throwable == null || type == null) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ public class ExceptionUtils {
|
|||
* @param throwable the throwable to output
|
||||
* @since 2.0
|
||||
*/
|
||||
public static void printRootCauseStackTrace(Throwable throwable) {
|
||||
public static void printRootCauseStackTrace(final Throwable throwable) {
|
||||
printRootCauseStackTrace(throwable, System.err);
|
||||
}
|
||||
|
||||
|
@ -452,7 +452,7 @@ public class ExceptionUtils {
|
|||
* @throws IllegalArgumentException if the stream is <code>null</code>
|
||||
* @since 2.0
|
||||
*/
|
||||
public static void printRootCauseStackTrace(Throwable throwable, PrintStream stream) {
|
||||
public static void printRootCauseStackTrace(final Throwable throwable, final PrintStream stream) {
|
||||
if (throwable == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ public class ExceptionUtils {
|
|||
* @throws IllegalArgumentException if the writer is <code>null</code>
|
||||
* @since 2.0
|
||||
*/
|
||||
public static void printRootCauseStackTrace(Throwable throwable, PrintWriter writer) {
|
||||
public static void printRootCauseStackTrace(final Throwable throwable, final PrintWriter writer) {
|
||||
if (throwable == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ public class ExceptionUtils {
|
|||
* @return an array of stack trace frames, never null
|
||||
* @since 2.0
|
||||
*/
|
||||
public static String[] getRootCauseStackTrace(Throwable throwable) {
|
||||
public static String[] getRootCauseStackTrace(final Throwable throwable) {
|
||||
if (throwable == null) {
|
||||
return ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ public class ExceptionUtils {
|
|||
* @throws IllegalArgumentException if either argument is null
|
||||
* @since 2.0
|
||||
*/
|
||||
public static void removeCommonFrames(List<String> causeFrames, List<String> wrapperFrames) {
|
||||
public static void removeCommonFrames(final List<String> causeFrames, final List<String> wrapperFrames) {
|
||||
if (causeFrames == null || wrapperFrames == null) {
|
||||
throw new IllegalArgumentException("The List must not be null");
|
||||
}
|
||||
|
@ -579,7 +579,7 @@ public class ExceptionUtils {
|
|||
* @return the stack trace as generated by the exception's
|
||||
* <code>printStackTrace(PrintWriter)</code> method
|
||||
*/
|
||||
public static String getStackTrace(Throwable throwable) {
|
||||
public static String getStackTrace(final Throwable throwable) {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw, true);
|
||||
throwable.printStackTrace(pw);
|
||||
|
@ -599,7 +599,7 @@ public class ExceptionUtils {
|
|||
* @param throwable the <code>Throwable</code> to examine, may be null
|
||||
* @return an array of strings describing each stack frame, never null
|
||||
*/
|
||||
public static String[] getStackFrames(Throwable throwable) {
|
||||
public static String[] getStackFrames(final Throwable throwable) {
|
||||
if (throwable == null) {
|
||||
return ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
}
|
||||
|
@ -615,7 +615,7 @@ public class ExceptionUtils {
|
|||
* @param stackTrace a stack trace String
|
||||
* @return an array where each element is a line from the argument
|
||||
*/
|
||||
static String[] getStackFrames(String stackTrace) {
|
||||
static String[] getStackFrames(final String stackTrace) {
|
||||
String linebreak = SystemUtils.LINE_SEPARATOR;
|
||||
StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
@ -637,7 +637,7 @@ public class ExceptionUtils {
|
|||
* @param t is any throwable
|
||||
* @return List of stack frames
|
||||
*/
|
||||
static List<String> getStackFrameList(Throwable t) {
|
||||
static List<String> getStackFrameList(final Throwable t) {
|
||||
String stackTrace = getStackTrace(t);
|
||||
String linebreak = SystemUtils.LINE_SEPARATOR;
|
||||
StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
|
||||
|
@ -668,7 +668,7 @@ public class ExceptionUtils {
|
|||
* @return the message, non-null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public static String getMessage(Throwable th) {
|
||||
public static String getMessage(final Throwable th) {
|
||||
if (th == null) {
|
||||
return "";
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ public class ExceptionUtils {
|
|||
* @return the message, non-null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public static String getRootCauseMessage(Throwable th) {
|
||||
public static String getRootCauseMessage(final Throwable th) {
|
||||
Throwable root = ExceptionUtils.getRootCause(th);
|
||||
root = root == null ? th : root;
|
||||
return getMessage(root);
|
||||
|
|
|
@ -120,7 +120,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @param numerator the numerator, for example the three in 'three sevenths'
|
||||
* @param denominator the denominator, for example the seven in 'three sevenths'
|
||||
*/
|
||||
private Fraction(int numerator, int denominator) {
|
||||
private Fraction(final int numerator, final int denominator) {
|
||||
super();
|
||||
this.numerator = numerator;
|
||||
this.denominator = denominator;
|
||||
|
@ -169,7 +169,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the resulting numerator exceeds
|
||||
* <code>Integer.MAX_VALUE</code>
|
||||
*/
|
||||
public static Fraction getFraction(int whole, int numerator, int denominator) {
|
||||
public static Fraction getFraction(final int whole, final int numerator, final int denominator) {
|
||||
if (denominator == 0) {
|
||||
throw new ArithmeticException("The denominator must not be zero");
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the resulting numerator or denominator exceeds
|
||||
* <code>Integer.MAX_VALUE</code>
|
||||
*/
|
||||
public Fraction pow(int power) {
|
||||
public Fraction pow(final int power) {
|
||||
if (power == 1) {
|
||||
return this;
|
||||
} else if (power == 0) {
|
||||
|
@ -636,7 +636,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the result can not be represented as
|
||||
* an int
|
||||
*/
|
||||
private static int mulAndCheck(int x, int y) {
|
||||
private static int mulAndCheck(final int x, final int y) {
|
||||
long m = (long)x*(long)y;
|
||||
if (m < Integer.MIN_VALUE ||
|
||||
m > Integer.MAX_VALUE) {
|
||||
|
@ -654,7 +654,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the result can not be represented as
|
||||
* an int
|
||||
*/
|
||||
private static int mulPosAndCheck(int x, int y) {
|
||||
private static int mulPosAndCheck(final int x, final int y) {
|
||||
/* assert x>=0 && y>=0; */
|
||||
long m = (long)x*(long)y;
|
||||
if (m > Integer.MAX_VALUE) {
|
||||
|
@ -672,7 +672,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the result can not be represented as
|
||||
* an int
|
||||
*/
|
||||
private static int addAndCheck(int x, int y) {
|
||||
private static int addAndCheck(final int x, final int y) {
|
||||
long s = (long)x+(long)y;
|
||||
if (s < Integer.MIN_VALUE ||
|
||||
s > Integer.MAX_VALUE) {
|
||||
|
@ -690,7 +690,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the result can not be represented as
|
||||
* an int
|
||||
*/
|
||||
private static int subAndCheck(int x, int y) {
|
||||
private static int subAndCheck(final int x, final int y) {
|
||||
long s = (long)x-(long)y;
|
||||
if (s < Integer.MIN_VALUE ||
|
||||
s > Integer.MAX_VALUE) {
|
||||
|
@ -709,7 +709,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the resulting numerator or denominator exceeds
|
||||
* <code>Integer.MAX_VALUE</code>
|
||||
*/
|
||||
public Fraction add(Fraction fraction) {
|
||||
public Fraction add(final Fraction fraction) {
|
||||
return addSub(fraction, true /* add */);
|
||||
}
|
||||
|
||||
|
@ -723,7 +723,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the resulting numerator or denominator
|
||||
* cannot be represented in an <code>int</code>.
|
||||
*/
|
||||
public Fraction subtract(Fraction fraction) {
|
||||
public Fraction subtract(final Fraction fraction) {
|
||||
return addSub(fraction, false /* subtract */);
|
||||
}
|
||||
|
||||
|
@ -737,7 +737,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the resulting numerator or denominator
|
||||
* cannot be represented in an <code>int</code>.
|
||||
*/
|
||||
private Fraction addSub(Fraction fraction, boolean isAdd) {
|
||||
private Fraction addSub(final Fraction fraction, final boolean isAdd) {
|
||||
if (fraction == null) {
|
||||
throw new IllegalArgumentException("The fraction must not be null");
|
||||
}
|
||||
|
@ -793,7 +793,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the resulting numerator or denominator exceeds
|
||||
* <code>Integer.MAX_VALUE</code>
|
||||
*/
|
||||
public Fraction multiplyBy(Fraction fraction) {
|
||||
public Fraction multiplyBy(final Fraction fraction) {
|
||||
if (fraction == null) {
|
||||
throw new IllegalArgumentException("The fraction must not be null");
|
||||
}
|
||||
|
@ -819,7 +819,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws ArithmeticException if the resulting numerator or denominator exceeds
|
||||
* <code>Integer.MAX_VALUE</code>
|
||||
*/
|
||||
public Fraction divideBy(Fraction fraction) {
|
||||
public Fraction divideBy(final Fraction fraction) {
|
||||
if (fraction == null) {
|
||||
throw new IllegalArgumentException("The fraction must not be null");
|
||||
}
|
||||
|
@ -841,7 +841,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @return <code>true</code> if this object is equal
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
@ -880,7 +880,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
|||
* @throws NullPointerException if the object is <code>null</code>
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(Fraction other) {
|
||||
public int compareTo(final Fraction other) {
|
||||
if (this==other) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class IEEE754rUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static double min(double[] array) {
|
||||
public static double min(final double[] array) {
|
||||
// Validates input
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
|
@ -59,7 +59,7 @@ public class IEEE754rUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static float min(float[] array) {
|
||||
public static float min(final float[] array) {
|
||||
// Validates input
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
|
@ -86,7 +86,7 @@ public class IEEE754rUtils {
|
|||
* @param c value 3
|
||||
* @return the smallest of the values
|
||||
*/
|
||||
public static double min(double a, double b, double c) {
|
||||
public static double min(final double a, final double b, final double c) {
|
||||
return min(min(a, b), c);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ public class IEEE754rUtils {
|
|||
* @param b value 2
|
||||
* @return the smallest of the values
|
||||
*/
|
||||
public static double min(double a, double b) {
|
||||
public static double min(final double a, final double b) {
|
||||
if(Double.isNaN(a)) {
|
||||
return b;
|
||||
} else
|
||||
|
@ -120,7 +120,7 @@ public class IEEE754rUtils {
|
|||
* @param c value 3
|
||||
* @return the smallest of the values
|
||||
*/
|
||||
public static float min(float a, float b, float c) {
|
||||
public static float min(final float a, final float b, final float c) {
|
||||
return min(min(a, b), c);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class IEEE754rUtils {
|
|||
* @param b value 2
|
||||
* @return the smallest of the values
|
||||
*/
|
||||
public static float min(float a, float b) {
|
||||
public static float min(final float a, final float b) {
|
||||
if(Float.isNaN(a)) {
|
||||
return b;
|
||||
} else
|
||||
|
@ -152,7 +152,7 @@ public class IEEE754rUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static double max(double[] array) {
|
||||
public static double max(final double[] array) {
|
||||
// Validates input
|
||||
if (array== null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
|
@ -177,7 +177,7 @@ public class IEEE754rUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static float max(float[] array) {
|
||||
public static float max(final float[] array) {
|
||||
// Validates input
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
|
@ -204,7 +204,7 @@ public class IEEE754rUtils {
|
|||
* @param c value 3
|
||||
* @return the largest of the values
|
||||
*/
|
||||
public static double max(double a, double b, double c) {
|
||||
public static double max(final double a, final double b, final double c) {
|
||||
return max(max(a, b), c);
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ public class IEEE754rUtils {
|
|||
* @param b value 2
|
||||
* @return the largest of the values
|
||||
*/
|
||||
public static double max(double a, double b) {
|
||||
public static double max(final double a, final double b) {
|
||||
if(Double.isNaN(a)) {
|
||||
return b;
|
||||
} else
|
||||
|
@ -238,7 +238,7 @@ public class IEEE754rUtils {
|
|||
* @param c value 3
|
||||
* @return the largest of the values
|
||||
*/
|
||||
public static float max(float a, float b, float c) {
|
||||
public static float max(final float a, final float b, final float c) {
|
||||
return max(max(a, b), c);
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ public class IEEE754rUtils {
|
|||
* @param b value 2
|
||||
* @return the largest of the values
|
||||
*/
|
||||
public static float max(float a, float b) {
|
||||
public static float max(final float a, final float b) {
|
||||
if(Float.isNaN(a)) {
|
||||
return b;
|
||||
} else
|
||||
|
|
|
@ -96,7 +96,7 @@ public class NumberUtils {
|
|||
* conversion fails
|
||||
* @since 2.1
|
||||
*/
|
||||
public static int toInt(String str) {
|
||||
public static int toInt(final String str) {
|
||||
return toInt(str, 0);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class NumberUtils {
|
|||
* @return the int represented by the string, or the default if conversion fails
|
||||
* @since 2.1
|
||||
*/
|
||||
public static int toInt(String str, int defaultValue) {
|
||||
public static int toInt(final String str, final int defaultValue) {
|
||||
if(str == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class NumberUtils {
|
|||
* conversion fails
|
||||
* @since 2.1
|
||||
*/
|
||||
public static long toLong(String str) {
|
||||
public static long toLong(final String str) {
|
||||
return toLong(str, 0L);
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class NumberUtils {
|
|||
* @return the long represented by the string, or the default if conversion fails
|
||||
* @since 2.1
|
||||
*/
|
||||
public static long toLong(String str, long defaultValue) {
|
||||
public static long toLong(final String str, final long defaultValue) {
|
||||
if (str == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public class NumberUtils {
|
|||
* if conversion fails
|
||||
* @since 2.1
|
||||
*/
|
||||
public static float toFloat(String str) {
|
||||
public static float toFloat(final String str) {
|
||||
return toFloat(str, 0.0f);
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ public class NumberUtils {
|
|||
* if conversion fails
|
||||
* @since 2.1
|
||||
*/
|
||||
public static float toFloat(String str, float defaultValue) {
|
||||
public static float toFloat(final String str, final float defaultValue) {
|
||||
if (str == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ public class NumberUtils {
|
|||
* if conversion fails
|
||||
* @since 2.1
|
||||
*/
|
||||
public static double toDouble(String str) {
|
||||
public static double toDouble(final String str) {
|
||||
return toDouble(str, 0.0d);
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ public class NumberUtils {
|
|||
* if conversion fails
|
||||
* @since 2.1
|
||||
*/
|
||||
public static double toDouble(String str, double defaultValue) {
|
||||
public static double toDouble(final String str, final double defaultValue) {
|
||||
if (str == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ public class NumberUtils {
|
|||
* conversion fails
|
||||
* @since 2.5
|
||||
*/
|
||||
public static byte toByte(String str) {
|
||||
public static byte toByte(final String str) {
|
||||
return toByte(str, (byte) 0);
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ public class NumberUtils {
|
|||
* @return the byte represented by the string, or the default if conversion fails
|
||||
* @since 2.5
|
||||
*/
|
||||
public static byte toByte(String str, byte defaultValue) {
|
||||
public static byte toByte(final String str, final byte defaultValue) {
|
||||
if(str == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ public class NumberUtils {
|
|||
* conversion fails
|
||||
* @since 2.5
|
||||
*/
|
||||
public static short toShort(String str) {
|
||||
public static short toShort(final String str) {
|
||||
return toShort(str, (short) 0);
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ public class NumberUtils {
|
|||
* @return the short represented by the string, or the default if conversion fails
|
||||
* @since 2.5
|
||||
*/
|
||||
public static short toShort(String str, short defaultValue) {
|
||||
public static short toShort(final String str, final short defaultValue) {
|
||||
if(str == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ public class NumberUtils {
|
|||
* @return Number created from the string (or null if the input is null)
|
||||
* @throws NumberFormatException if the value cannot be converted
|
||||
*/
|
||||
public static Number createNumber(String str) throws NumberFormatException {
|
||||
public static Number createNumber(final String str) throws NumberFormatException {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ public class NumberUtils {
|
|||
* @param str the String to check
|
||||
* @return if it is all zeros or <code>null</code>
|
||||
*/
|
||||
private static boolean isAllZeros(String str) {
|
||||
private static boolean isAllZeros(final String str) {
|
||||
if (str == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ public class NumberUtils {
|
|||
* @return converted <code>Float</code> (or null if the input is null)
|
||||
* @throws NumberFormatException if the value cannot be converted
|
||||
*/
|
||||
public static Float createFloat(String str) {
|
||||
public static Float createFloat(final String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ public class NumberUtils {
|
|||
* @return converted <code>Double</code> (or null if the input is null)
|
||||
* @throws NumberFormatException if the value cannot be converted
|
||||
*/
|
||||
public static Double createDouble(String str) {
|
||||
public static Double createDouble(final String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ public class NumberUtils {
|
|||
* @return converted <code>Integer</code> (or null if the input is null)
|
||||
* @throws NumberFormatException if the value cannot be converted
|
||||
*/
|
||||
public static Integer createInteger(String str) {
|
||||
public static Integer createInteger(final String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -685,7 +685,7 @@ public class NumberUtils {
|
|||
* @return converted <code>Long</code> (or null if the input is null)
|
||||
* @throws NumberFormatException if the value cannot be converted
|
||||
*/
|
||||
public static Long createLong(String str) {
|
||||
public static Long createLong(final String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ public class NumberUtils {
|
|||
* @return converted <code>BigInteger</code> (or null if the input is null)
|
||||
* @throws NumberFormatException if the value cannot be converted
|
||||
*/
|
||||
public static BigInteger createBigInteger(String str) {
|
||||
public static BigInteger createBigInteger(final String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -737,7 +737,7 @@ public class NumberUtils {
|
|||
* @return converted <code>BigDecimal</code> (or null if the input is null)
|
||||
* @throws NumberFormatException if the value cannot be converted
|
||||
*/
|
||||
public static BigDecimal createBigDecimal(String str) {
|
||||
public static BigDecimal createBigDecimal(final String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -765,7 +765,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static long min(long[] array) {
|
||||
public static long min(final long[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -788,7 +788,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static int min(int[] array) {
|
||||
public static int min(final int[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -811,7 +811,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static short min(short[] array) {
|
||||
public static short min(final short[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -834,7 +834,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static byte min(byte[] array) {
|
||||
public static byte min(final byte[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -858,7 +858,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
* @see IEEE754rUtils#min(double[]) IEEE754rUtils for a version of this method that handles NaN differently
|
||||
*/
|
||||
public static double min(double[] array) {
|
||||
public static double min(final double[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -885,7 +885,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
* @see IEEE754rUtils#min(float[]) IEEE754rUtils for a version of this method that handles NaN differently
|
||||
*/
|
||||
public static float min(float[] array) {
|
||||
public static float min(final float[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -913,7 +913,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static long max(long[] array) {
|
||||
public static long max(final long[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -936,7 +936,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static int max(int[] array) {
|
||||
public static int max(final int[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -959,7 +959,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static short max(short[] array) {
|
||||
public static short max(final short[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -982,7 +982,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
*/
|
||||
public static byte max(byte[] array) {
|
||||
public static byte max(final byte[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
* @see IEEE754rUtils#max(double[]) IEEE754rUtils for a version of this method that handles NaN differently
|
||||
*/
|
||||
public static double max(double[] array) {
|
||||
public static double max(final double[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ public class NumberUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is empty
|
||||
* @see IEEE754rUtils#max(float[]) IEEE754rUtils for a version of this method that handles NaN differently
|
||||
*/
|
||||
public static float max(float[] array) {
|
||||
public static float max(final float[] array) {
|
||||
// Validates input
|
||||
validateArray(array);
|
||||
|
||||
|
@ -1051,7 +1051,7 @@ public class NumberUtils {
|
|||
return max;
|
||||
}
|
||||
|
||||
private static void validateArray(Object array) {
|
||||
private static void validateArray(final Object array) {
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
} else if (Array.getLength(array) == 0) {
|
||||
|
@ -1069,7 +1069,7 @@ public class NumberUtils {
|
|||
* @param c value 3
|
||||
* @return the smallest of the values
|
||||
*/
|
||||
public static long min(long a, long b, long c) {
|
||||
public static long min(long a, final long b, final long c) {
|
||||
if (b < a) {
|
||||
a = b;
|
||||
}
|
||||
|
@ -1087,7 +1087,7 @@ public class NumberUtils {
|
|||
* @param c value 3
|
||||
* @return the smallest of the values
|
||||
*/
|
||||
public static int min(int a, int b, int c) {
|
||||
public static int min(int a, final int b, final int c) {
|
||||
if (b < a) {
|
||||
a = b;
|
||||
}
|
||||
|
@ -1105,7 +1105,7 @@ public class NumberUtils {
|
|||
* @param c value 3
|
||||
* @return the smallest of the values
|
||||
*/
|
||||
public static short min(short a, short b, short c) {
|
||||
public static short min(short a, final short b, final short c) {
|
||||
if (b < a) {
|
||||
a = b;
|
||||
}
|
||||
|
@ -1123,7 +1123,7 @@ public class NumberUtils {
|
|||
* @param c value 3
|
||||
* @return the smallest of the values
|
||||
*/
|
||||
public static byte min(byte a, byte b, byte c) {
|
||||
public static byte min(byte a, final byte b, final byte c) {
|
||||
if (b < a) {
|
||||
a = b;
|
||||
}
|
||||
|
@ -1145,7 +1145,7 @@ public class NumberUtils {
|
|||
* @return the smallest of the values
|
||||
* @see IEEE754rUtils#min(double, double, double) for a version of this method that handles NaN differently
|
||||
*/
|
||||
public static double min(double a, double b, double c) {
|
||||
public static double min(final double a, final double b, final double c) {
|
||||
return Math.min(Math.min(a, b), c);
|
||||
}
|
||||
|
||||
|
@ -1161,7 +1161,7 @@ public class NumberUtils {
|
|||
* @return the smallest of the values
|
||||
* @see IEEE754rUtils#min(float, float, float) for a version of this method that handles NaN differently
|
||||
*/
|
||||
public static float min(float a, float b, float c) {
|
||||
public static float min(final float a, final float b, final float c) {
|
||||
return Math.min(Math.min(a, b), c);
|
||||
}
|
||||
|
||||
|
@ -1175,7 +1175,7 @@ public class NumberUtils {
|
|||
* @param c value 3
|
||||
* @return the largest of the values
|
||||
*/
|
||||
public static long max(long a, long b, long c) {
|
||||
public static long max(long a, final long b, final long c) {
|
||||
if (b > a) {
|
||||
a = b;
|
||||
}
|
||||
|
@ -1193,7 +1193,7 @@ public class NumberUtils {
|
|||
* @param c value 3
|
||||
* @return the largest of the values
|
||||
*/
|
||||
public static int max(int a, int b, int c) {
|
||||
public static int max(int a, final int b, final int c) {
|
||||
if (b > a) {
|
||||
a = b;
|
||||
}
|
||||
|
@ -1211,7 +1211,7 @@ public class NumberUtils {
|
|||
* @param c value 3
|
||||
* @return the largest of the values
|
||||
*/
|
||||
public static short max(short a, short b, short c) {
|
||||
public static short max(short a, final short b, final short c) {
|
||||
if (b > a) {
|
||||
a = b;
|
||||
}
|
||||
|
@ -1229,7 +1229,7 @@ public class NumberUtils {
|
|||
* @param c value 3
|
||||
* @return the largest of the values
|
||||
*/
|
||||
public static byte max(byte a, byte b, byte c) {
|
||||
public static byte max(byte a, final byte b, final byte c) {
|
||||
if (b > a) {
|
||||
a = b;
|
||||
}
|
||||
|
@ -1251,7 +1251,7 @@ public class NumberUtils {
|
|||
* @return the largest of the values
|
||||
* @see IEEE754rUtils#max(double, double, double) for a version of this method that handles NaN differently
|
||||
*/
|
||||
public static double max(double a, double b, double c) {
|
||||
public static double max(final double a, final double b, final double c) {
|
||||
return Math.max(Math.max(a, b), c);
|
||||
}
|
||||
|
||||
|
@ -1267,7 +1267,7 @@ public class NumberUtils {
|
|||
* @return the largest of the values
|
||||
* @see IEEE754rUtils#max(float, float, float) for a version of this method that handles NaN differently
|
||||
*/
|
||||
public static float max(float a, float b, float c) {
|
||||
public static float max(final float a, final float b, final float c) {
|
||||
return Math.max(Math.max(a, b), c);
|
||||
}
|
||||
|
||||
|
@ -1282,7 +1282,7 @@ public class NumberUtils {
|
|||
* @param str the <code>String</code> to check
|
||||
* @return <code>true</code> if str contains only Unicode numeric
|
||||
*/
|
||||
public static boolean isDigits(String str) {
|
||||
public static boolean isDigits(final String str) {
|
||||
if (StringUtils.isEmpty(str)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1307,7 +1307,7 @@ public class NumberUtils {
|
|||
* @param str the <code>String</code> to check
|
||||
* @return <code>true</code> if the string is a correctly formatted number
|
||||
*/
|
||||
public static boolean isNumber(String str) {
|
||||
public static boolean isNumber(final String str) {
|
||||
if (StringUtils.isEmpty(str)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
|
|||
*
|
||||
* @param value the initial value to store
|
||||
*/
|
||||
public MutableBoolean(boolean value) {
|
||||
public MutableBoolean(final boolean value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
|
|||
* @param value the initial value to store, not null
|
||||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
public MutableBoolean(Boolean value) {
|
||||
public MutableBoolean(final Boolean value) {
|
||||
super();
|
||||
this.value = value.booleanValue();
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
|
|||
*
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(boolean value) {
|
||||
public void setValue(final boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
|
|||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
@Override
|
||||
public void setValue(Boolean value) {
|
||||
public void setValue(final Boolean value) {
|
||||
this.value = value.booleanValue();
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
|
|||
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj instanceof MutableBoolean) {
|
||||
return value == ((MutableBoolean) obj).booleanValue();
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
|
|||
* where false is less than true
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(MutableBoolean other) {
|
||||
public int compareTo(final MutableBoolean other) {
|
||||
boolean anotherVal = other.value;
|
||||
return value == anotherVal ? 0 : (value ? 1 : -1);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
*
|
||||
* @param value the initial value to store
|
||||
*/
|
||||
public MutableByte(byte value) {
|
||||
public MutableByte(final byte value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
* @param value the initial value to store, not null
|
||||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
public MutableByte(Number value) {
|
||||
public MutableByte(final Number value) {
|
||||
super();
|
||||
this.value = value.byteValue();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
* @throws NumberFormatException if the string cannot be parsed into a byte
|
||||
* @since 2.5
|
||||
*/
|
||||
public MutableByte(String value) throws NumberFormatException {
|
||||
public MutableByte(final String value) throws NumberFormatException {
|
||||
super();
|
||||
this.value = Byte.parseByte(value);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
*
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(byte value) {
|
||||
public void setValue(final byte value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
@Override
|
||||
public void setValue(Number value) {
|
||||
public void setValue(final Number value) {
|
||||
this.value = value.byteValue();
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
* @param operand the value to add, not null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(byte operand) {
|
||||
public void add(final byte operand) {
|
||||
this.value += operand;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(Number operand) {
|
||||
public void add(final Number operand) {
|
||||
this.value += operand.byteValue();
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
* @param operand the value to subtract, not null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(byte operand) {
|
||||
public void subtract(final byte operand) {
|
||||
this.value -= operand;
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(Number operand) {
|
||||
public void subtract(final Number operand) {
|
||||
this.value -= operand.byteValue();
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj instanceof MutableByte) {
|
||||
return value == ((MutableByte) obj).byteValue();
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
|
|||
* @return negative if this is less, zero if equal, positive if greater
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(MutableByte other) {
|
||||
public int compareTo(final MutableByte other) {
|
||||
byte anotherVal = other.value;
|
||||
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
*
|
||||
* @param value the initial value to store
|
||||
*/
|
||||
public MutableDouble(double value) {
|
||||
public MutableDouble(final double value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
* @param value the initial value to store, not null
|
||||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
public MutableDouble(Number value) {
|
||||
public MutableDouble(final Number value) {
|
||||
super();
|
||||
this.value = value.doubleValue();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
* @throws NumberFormatException if the string cannot be parsed into a double
|
||||
* @since 2.5
|
||||
*/
|
||||
public MutableDouble(String value) throws NumberFormatException {
|
||||
public MutableDouble(final String value) throws NumberFormatException {
|
||||
super();
|
||||
this.value = Double.parseDouble(value);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
*
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(double value) {
|
||||
public void setValue(final double value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
@Override
|
||||
public void setValue(Number value) {
|
||||
public void setValue(final Number value) {
|
||||
this.value = value.doubleValue();
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
* @param operand the value to add
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(double operand) {
|
||||
public void add(final double operand) {
|
||||
this.value += operand;
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(Number operand) {
|
||||
public void add(final Number operand) {
|
||||
this.value += operand.doubleValue();
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
* @param operand the value to subtract, not null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(double operand) {
|
||||
public void subtract(final double operand) {
|
||||
this.value -= operand;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(Number operand) {
|
||||
public void subtract(final Number operand) {
|
||||
this.value -= operand.doubleValue();
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
return obj instanceof MutableDouble
|
||||
&& Double.doubleToLongBits(((MutableDouble) obj).value) == Double.doubleToLongBits(value);
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
|
|||
* @return negative if this is less, zero if equal, positive if greater
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(MutableDouble other) {
|
||||
public int compareTo(final MutableDouble other) {
|
||||
double anotherVal = other.value;
|
||||
return Double.compare(value, anotherVal);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
*
|
||||
* @param value the initial value to store
|
||||
*/
|
||||
public MutableFloat(float value) {
|
||||
public MutableFloat(final float value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
* @param value the initial value to store, not null
|
||||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
public MutableFloat(Number value) {
|
||||
public MutableFloat(final Number value) {
|
||||
super();
|
||||
this.value = value.floatValue();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
* @throws NumberFormatException if the string cannot be parsed into a float
|
||||
* @since 2.5
|
||||
*/
|
||||
public MutableFloat(String value) throws NumberFormatException {
|
||||
public MutableFloat(final String value) throws NumberFormatException {
|
||||
super();
|
||||
this.value = Float.parseFloat(value);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
*
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(float value) {
|
||||
public void setValue(final float value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
@Override
|
||||
public void setValue(Number value) {
|
||||
public void setValue(final Number value) {
|
||||
this.value = value.floatValue();
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
* @param operand the value to add, not null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(float operand) {
|
||||
public void add(final float operand) {
|
||||
this.value += operand;
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(Number operand) {
|
||||
public void add(final Number operand) {
|
||||
this.value += operand.floatValue();
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
* @param operand the value to subtract
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(float operand) {
|
||||
public void subtract(final float operand) {
|
||||
this.value -= operand;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(Number operand) {
|
||||
public void subtract(final Number operand) {
|
||||
this.value -= operand.floatValue();
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
* @see java.lang.Float#floatToIntBits(float)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
return obj instanceof MutableFloat
|
||||
&& Float.floatToIntBits(((MutableFloat) obj).value) == Float.floatToIntBits(value);
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
|
|||
* @return negative if this is less, zero if equal, positive if greater
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(MutableFloat other) {
|
||||
public int compareTo(final MutableFloat other) {
|
||||
float anotherVal = other.value;
|
||||
return Float.compare(value, anotherVal);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
*
|
||||
* @param value the initial value to store
|
||||
*/
|
||||
public MutableInt(int value) {
|
||||
public MutableInt(final int value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
* @param value the initial value to store, not null
|
||||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
public MutableInt(Number value) {
|
||||
public MutableInt(final Number value) {
|
||||
super();
|
||||
this.value = value.intValue();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
* @throws NumberFormatException if the string cannot be parsed into an int
|
||||
* @since 2.5
|
||||
*/
|
||||
public MutableInt(String value) throws NumberFormatException {
|
||||
public MutableInt(final String value) throws NumberFormatException {
|
||||
super();
|
||||
this.value = Integer.parseInt(value);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
*
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(int value) {
|
||||
public void setValue(final int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
@Override
|
||||
public void setValue(Number value) {
|
||||
public void setValue(final Number value) {
|
||||
this.value = value.intValue();
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
* @param operand the value to add, not null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(int operand) {
|
||||
public void add(final int operand) {
|
||||
this.value += operand;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(Number operand) {
|
||||
public void add(final Number operand) {
|
||||
this.value += operand.intValue();
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
* @param operand the value to subtract, not null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(int operand) {
|
||||
public void subtract(final int operand) {
|
||||
this.value -= operand;
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(Number operand) {
|
||||
public void subtract(final Number operand) {
|
||||
this.value -= operand.intValue();
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj instanceof MutableInt) {
|
||||
return value == ((MutableInt) obj).intValue();
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
|
|||
* @return negative if this is less, zero if equal, positive if greater
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(MutableInt other) {
|
||||
public int compareTo(final MutableInt other) {
|
||||
int anotherVal = other.value;
|
||||
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
*
|
||||
* @param value the initial value to store
|
||||
*/
|
||||
public MutableLong(long value) {
|
||||
public MutableLong(final long value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
* @param value the initial value to store, not null
|
||||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
public MutableLong(Number value) {
|
||||
public MutableLong(final Number value) {
|
||||
super();
|
||||
this.value = value.longValue();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
* @throws NumberFormatException if the string cannot be parsed into a long
|
||||
* @since 2.5
|
||||
*/
|
||||
public MutableLong(String value) throws NumberFormatException {
|
||||
public MutableLong(final String value) throws NumberFormatException {
|
||||
super();
|
||||
this.value = Long.parseLong(value);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
*
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(long value) {
|
||||
public void setValue(final long value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
@Override
|
||||
public void setValue(Number value) {
|
||||
public void setValue(final Number value) {
|
||||
this.value = value.longValue();
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
* @param operand the value to add, not null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(long operand) {
|
||||
public void add(final long operand) {
|
||||
this.value += operand;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(Number operand) {
|
||||
public void add(final Number operand) {
|
||||
this.value += operand.longValue();
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
* @param operand the value to subtract, not null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(long operand) {
|
||||
public void subtract(final long operand) {
|
||||
this.value -= operand;
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(Number operand) {
|
||||
public void subtract(final Number operand) {
|
||||
this.value -= operand.longValue();
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj instanceof MutableLong) {
|
||||
return value == ((MutableLong) obj).longValue();
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
|
|||
* @return negative if this is less, zero if equal, positive if greater
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(MutableLong other) {
|
||||
public int compareTo(final MutableLong other) {
|
||||
long anotherVal = other.value;
|
||||
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MutableObject<T> implements Mutable<T>, Serializable {
|
|||
*
|
||||
* @param value the initial value to store
|
||||
*/
|
||||
public MutableObject(T value) {
|
||||
public MutableObject(final T value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class MutableObject<T> implements Mutable<T>, Serializable {
|
|||
* @param value the value to set
|
||||
*/
|
||||
@Override
|
||||
public void setValue(T value) {
|
||||
public void setValue(final T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class MutableObject<T> implements Mutable<T>, Serializable {
|
|||
* <code>false</code> otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
*
|
||||
* @param value the initial value to store
|
||||
*/
|
||||
public MutableShort(short value) {
|
||||
public MutableShort(final short value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
* @param value the initial value to store, not null
|
||||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
public MutableShort(Number value) {
|
||||
public MutableShort(final Number value) {
|
||||
super();
|
||||
this.value = value.shortValue();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
* @throws NumberFormatException if the string cannot be parsed into a short
|
||||
* @since 2.5
|
||||
*/
|
||||
public MutableShort(String value) throws NumberFormatException {
|
||||
public MutableShort(final String value) throws NumberFormatException {
|
||||
super();
|
||||
this.value = Short.parseShort(value);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
*
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(short value) {
|
||||
public void setValue(final short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
* @throws NullPointerException if the object is null
|
||||
*/
|
||||
@Override
|
||||
public void setValue(Number value) {
|
||||
public void setValue(final Number value) {
|
||||
this.value = value.shortValue();
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
* @param operand the value to add, not null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(short operand) {
|
||||
public void add(final short operand) {
|
||||
this.value += operand;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void add(Number operand) {
|
||||
public void add(final Number operand) {
|
||||
this.value += operand.shortValue();
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
* @param operand the value to subtract, not null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(short operand) {
|
||||
public void subtract(final short operand) {
|
||||
this.value -= operand;
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
* @throws NullPointerException if the object is null
|
||||
* @since Commons Lang 2.2
|
||||
*/
|
||||
public void subtract(Number operand) {
|
||||
public void subtract(final Number operand) {
|
||||
this.value -= operand.shortValue();
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj instanceof MutableShort) {
|
||||
return value == ((MutableShort) obj).shortValue();
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
|
|||
* @return negative if this is less, zero if equal, positive if greater
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(MutableShort other) {
|
||||
public int compareTo(final MutableShort other) {
|
||||
short anotherVal = other.value;
|
||||
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class ConstructorUtils {
|
|||
* @throws InstantiationException if an error occurs on instantiation
|
||||
* @see #invokeConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])
|
||||
*/
|
||||
public static <T> T invokeConstructor(Class<T> cls, Object... args)
|
||||
public static <T> T invokeConstructor(final Class<T> cls, Object... args)
|
||||
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
|
||||
InstantiationException {
|
||||
if (args == null) {
|
||||
|
@ -104,7 +104,7 @@ public class ConstructorUtils {
|
|||
* @throws InstantiationException if an error occurs on instantiation
|
||||
* @see Constructor#newInstance
|
||||
*/
|
||||
public static <T> T invokeConstructor(Class<T> cls, Object[] args, Class<?>[] parameterTypes)
|
||||
public static <T> T invokeConstructor(final Class<T> cls, Object[] args, Class<?>[] parameterTypes)
|
||||
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
|
||||
InstantiationException {
|
||||
if (parameterTypes == null) {
|
||||
|
@ -139,7 +139,7 @@ public class ConstructorUtils {
|
|||
* @throws InstantiationException if an error occurs on instantiation
|
||||
* @see #invokeExactConstructor(java.lang.Class, java.lang.Object[], java.lang.Class[])
|
||||
*/
|
||||
public static <T> T invokeExactConstructor(Class<T> cls, Object... args)
|
||||
public static <T> T invokeExactConstructor(final Class<T> cls, Object... args)
|
||||
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
|
||||
InstantiationException {
|
||||
if (args == null) {
|
||||
|
@ -168,7 +168,7 @@ public class ConstructorUtils {
|
|||
* @throws InstantiationException if an error occurs on instantiation
|
||||
* @see Constructor#newInstance
|
||||
*/
|
||||
public static <T> T invokeExactConstructor(Class<T> cls, Object[] args,
|
||||
public static <T> T invokeExactConstructor(final Class<T> cls, Object[] args,
|
||||
Class<?>[] parameterTypes) throws NoSuchMethodException, IllegalAccessException,
|
||||
InvocationTargetException, InstantiationException {
|
||||
if (args == null) {
|
||||
|
@ -199,8 +199,8 @@ public class ConstructorUtils {
|
|||
* @see Class#getConstructor
|
||||
* @see #getAccessibleConstructor(java.lang.reflect.Constructor)
|
||||
*/
|
||||
public static <T> Constructor<T> getAccessibleConstructor(Class<T> cls,
|
||||
Class<?>... parameterTypes) {
|
||||
public static <T> Constructor<T> getAccessibleConstructor(final Class<T> cls,
|
||||
final Class<?>... parameterTypes) {
|
||||
try {
|
||||
return getAccessibleConstructor(cls.getConstructor(parameterTypes));
|
||||
} catch (NoSuchMethodException e) {
|
||||
|
@ -218,7 +218,7 @@ public class ConstructorUtils {
|
|||
* @return the constructor, null if no matching accessible constructor found
|
||||
* @see java.lang.SecurityManager
|
||||
*/
|
||||
public static <T> Constructor<T> getAccessibleConstructor(Constructor<T> ctor) {
|
||||
public static <T> Constructor<T> getAccessibleConstructor(final Constructor<T> ctor) {
|
||||
return MemberUtils.isAccessible(ctor)
|
||||
&& Modifier.isPublic(ctor.getDeclaringClass().getModifiers()) ? ctor : null;
|
||||
}
|
||||
|
@ -240,8 +240,8 @@ public class ConstructorUtils {
|
|||
* @param parameterTypes find method with compatible parameters
|
||||
* @return the constructor, null if no matching accessible constructor found
|
||||
*/
|
||||
public static <T> Constructor<T> getMatchingAccessibleConstructor(Class<T> cls,
|
||||
Class<?>... parameterTypes) {
|
||||
public static <T> Constructor<T> getMatchingAccessibleConstructor(final Class<T> cls,
|
||||
final Class<?>... parameterTypes) {
|
||||
// see if we can find the constructor directly
|
||||
// most of the time this works and it's much faster
|
||||
try {
|
||||
|
|
|
@ -53,7 +53,7 @@ public class FieldUtils {
|
|||
* @return the Field object
|
||||
* @throws IllegalArgumentException if the class or field name is null
|
||||
*/
|
||||
public static Field getField(Class<?> cls, String fieldName) {
|
||||
public static Field getField(final Class<?> cls, final String fieldName) {
|
||||
Field field = getField(cls, fieldName, false);
|
||||
MemberUtils.setAccessibleWorkaround(field);
|
||||
return field;
|
||||
|
@ -71,7 +71,7 @@ public class FieldUtils {
|
|||
* @return the Field object
|
||||
* @throws IllegalArgumentException if the class or field name is null
|
||||
*/
|
||||
public static Field getField(final Class<?> cls, String fieldName, boolean forceAccess) {
|
||||
public static Field getField(final Class<?> cls, final String fieldName, final boolean forceAccess) {
|
||||
if (cls == null) {
|
||||
throw new IllegalArgumentException("The class must not be null");
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class FieldUtils {
|
|||
* @return the Field object
|
||||
* @throws IllegalArgumentException if the class or field name is null
|
||||
*/
|
||||
public static Field getDeclaredField(Class<?> cls, String fieldName) {
|
||||
public static Field getDeclaredField(final Class<?> cls, final String fieldName) {
|
||||
return getDeclaredField(cls, fieldName, false);
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ public class FieldUtils {
|
|||
* @return the Field object
|
||||
* @throws IllegalArgumentException if the class or field name is null
|
||||
*/
|
||||
public static Field getDeclaredField(Class<?> cls, String fieldName, boolean forceAccess) {
|
||||
public static Field getDeclaredField(final Class<?> cls, final String fieldName, final boolean forceAccess) {
|
||||
if (cls == null) {
|
||||
throw new IllegalArgumentException("The class must not be null");
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field is null or not static
|
||||
* @throws IllegalAccessException if the field is not accessible
|
||||
*/
|
||||
public static Object readStaticField(Field field) throws IllegalAccessException {
|
||||
public static Object readStaticField(final Field field) throws IllegalAccessException {
|
||||
return readStaticField(field, false);
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field is null or not static
|
||||
* @throws IllegalAccessException if the field is not made accessible
|
||||
*/
|
||||
public static Object readStaticField(Field field, boolean forceAccess) throws IllegalAccessException {
|
||||
public static Object readStaticField(final Field field, final boolean forceAccess) throws IllegalAccessException {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException("The field must not be null");
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the class is null, the field name is null or if the field could not be found
|
||||
* @throws IllegalAccessException if the field is not accessible
|
||||
*/
|
||||
public static Object readStaticField(Class<?> cls, String fieldName) throws IllegalAccessException {
|
||||
public static Object readStaticField(final Class<?> cls, final String fieldName) throws IllegalAccessException {
|
||||
return readStaticField(cls, fieldName, false);
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the class is null, the field name is null or if the field could not be found
|
||||
* @throws IllegalAccessException if the field is not made accessible
|
||||
*/
|
||||
public static Object readStaticField(Class<?> cls, String fieldName, boolean forceAccess)
|
||||
public static Object readStaticField(final Class<?> cls, final String fieldName, final boolean forceAccess)
|
||||
throws IllegalAccessException {
|
||||
Field field = getField(cls, fieldName, forceAccess);
|
||||
if (field == null) {
|
||||
|
@ -249,7 +249,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the class is null, the field name is null or if the field could not be found
|
||||
* @throws IllegalAccessException if the field is not accessible
|
||||
*/
|
||||
public static Object readDeclaredStaticField(Class<?> cls, String fieldName) throws IllegalAccessException {
|
||||
public static Object readDeclaredStaticField(final Class<?> cls, final String fieldName) throws IllegalAccessException {
|
||||
return readDeclaredStaticField(cls, fieldName, false);
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the class is null, the field name is null or if the field could not be found
|
||||
* @throws IllegalAccessException if the field is not made accessible
|
||||
*/
|
||||
public static Object readDeclaredStaticField(Class<?> cls, String fieldName, boolean forceAccess)
|
||||
public static Object readDeclaredStaticField(final Class<?> cls, final String fieldName, final boolean forceAccess)
|
||||
throws IllegalAccessException {
|
||||
Field field = getDeclaredField(cls, fieldName, forceAccess);
|
||||
if (field == null) {
|
||||
|
@ -284,7 +284,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field is null
|
||||
* @throws IllegalAccessException if the field is not accessible
|
||||
*/
|
||||
public static Object readField(Field field, Object target) throws IllegalAccessException {
|
||||
public static Object readField(final Field field, final Object target) throws IllegalAccessException {
|
||||
return readField(field, target, false);
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field is null
|
||||
* @throws IllegalAccessException if the field is not made accessible
|
||||
*/
|
||||
public static Object readField(Field field, Object target, boolean forceAccess) throws IllegalAccessException {
|
||||
public static Object readField(final Field field, final Object target, final boolean forceAccess) throws IllegalAccessException {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException("The field must not be null");
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the class or field name is null
|
||||
* @throws IllegalAccessException if the named field is not public
|
||||
*/
|
||||
public static Object readField(Object target, String fieldName) throws IllegalAccessException {
|
||||
public static Object readField(final Object target, final String fieldName) throws IllegalAccessException {
|
||||
return readField(target, fieldName, false);
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the class or field name is null
|
||||
* @throws IllegalAccessException if the named field is not made accessible
|
||||
*/
|
||||
public static Object readField(Object target, String fieldName, boolean forceAccess) throws IllegalAccessException {
|
||||
public static Object readField(final Object target, final String fieldName, final boolean forceAccess) throws IllegalAccessException {
|
||||
if (target == null) {
|
||||
throw new IllegalArgumentException("target object must not be null");
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the class or field name is null
|
||||
* @throws IllegalAccessException if the named field is not public
|
||||
*/
|
||||
public static Object readDeclaredField(Object target, String fieldName) throws IllegalAccessException {
|
||||
public static Object readDeclaredField(final Object target, final String fieldName) throws IllegalAccessException {
|
||||
return readDeclaredField(target, fieldName, false);
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if <code>target</code> or <code>fieldName</code> is null
|
||||
* @throws IllegalAccessException if the field is not made accessible
|
||||
*/
|
||||
public static Object readDeclaredField(Object target, String fieldName, boolean forceAccess)
|
||||
public static Object readDeclaredField(final Object target, final String fieldName, final boolean forceAccess)
|
||||
throws IllegalAccessException {
|
||||
if (target == null) {
|
||||
throw new IllegalArgumentException("target object must not be null");
|
||||
|
@ -392,7 +392,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field is null or not static
|
||||
* @throws IllegalAccessException if the field is not public or is final
|
||||
*/
|
||||
public static void writeStaticField(Field field, Object value) throws IllegalAccessException {
|
||||
public static void writeStaticField(final Field field, final Object value) throws IllegalAccessException {
|
||||
writeStaticField(field, value, false);
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field is null or not static
|
||||
* @throws IllegalAccessException if the field is not made accessible or is final
|
||||
*/
|
||||
public static void writeStaticField(Field field, Object value, boolean forceAccess) throws IllegalAccessException {
|
||||
public static void writeStaticField(final Field field, final Object value, final boolean forceAccess) throws IllegalAccessException {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException("The field must not be null");
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field cannot be located or is not static
|
||||
* @throws IllegalAccessException if the field is not public or is final
|
||||
*/
|
||||
public static void writeStaticField(Class<?> cls, String fieldName, Object value) throws IllegalAccessException {
|
||||
public static void writeStaticField(final Class<?> cls, final String fieldName, final Object value) throws IllegalAccessException {
|
||||
writeStaticField(cls, fieldName, value, false);
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field cannot be located or is not static
|
||||
* @throws IllegalAccessException if the field is not made accessible or is final
|
||||
*/
|
||||
public static void writeStaticField(Class<?> cls, String fieldName, Object value, boolean forceAccess)
|
||||
public static void writeStaticField(final Class<?> cls, final String fieldName, final Object value, final boolean forceAccess)
|
||||
throws IllegalAccessException {
|
||||
Field field = getField(cls, fieldName, forceAccess);
|
||||
if (field == null) {
|
||||
|
@ -457,7 +457,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field cannot be located or is not static
|
||||
* @throws IllegalAccessException if the field is not public or is final
|
||||
*/
|
||||
public static void writeDeclaredStaticField(Class<?> cls, String fieldName, Object value)
|
||||
public static void writeDeclaredStaticField(final Class<?> cls, final String fieldName, final Object value)
|
||||
throws IllegalAccessException {
|
||||
writeDeclaredStaticField(cls, fieldName, value, false);
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field cannot be located or is not static
|
||||
* @throws IllegalAccessException if the field is not made accessible or is final
|
||||
*/
|
||||
public static void writeDeclaredStaticField(Class<?> cls, String fieldName, Object value, boolean forceAccess)
|
||||
public static void writeDeclaredStaticField(final Class<?> cls, final String fieldName, final Object value, final boolean forceAccess)
|
||||
throws IllegalAccessException {
|
||||
Field field = getDeclaredField(cls, fieldName, forceAccess);
|
||||
if (field == null) {
|
||||
|
@ -491,7 +491,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field is null
|
||||
* @throws IllegalAccessException if the field is not accessible or is final
|
||||
*/
|
||||
public static void writeField(Field field, Object target, Object value) throws IllegalAccessException {
|
||||
public static void writeField(final Field field, final Object target, final Object value) throws IllegalAccessException {
|
||||
writeField(field, target, value, false);
|
||||
}
|
||||
|
||||
|
@ -506,7 +506,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if the field is null
|
||||
* @throws IllegalAccessException if the field is not made accessible or is final
|
||||
*/
|
||||
public static void writeField(Field field, Object target, Object value, boolean forceAccess)
|
||||
public static void writeField(final Field field, final Object target, final Object value, final boolean forceAccess)
|
||||
throws IllegalAccessException {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException("The field must not be null");
|
||||
|
@ -527,7 +527,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if <code>target</code> or <code>fieldName</code> is null
|
||||
* @throws IllegalAccessException if the field is not accessible
|
||||
*/
|
||||
public static void writeField(Object target, String fieldName, Object value) throws IllegalAccessException {
|
||||
public static void writeField(final Object target, final String fieldName, final Object value) throws IllegalAccessException {
|
||||
writeField(target, fieldName, value, false);
|
||||
}
|
||||
|
||||
|
@ -542,7 +542,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if <code>target</code> or <code>fieldName</code> is null
|
||||
* @throws IllegalAccessException if the field is not made accessible
|
||||
*/
|
||||
public static void writeField(Object target, String fieldName, Object value, boolean forceAccess)
|
||||
public static void writeField(final Object target, final String fieldName, final Object value, final boolean forceAccess)
|
||||
throws IllegalAccessException {
|
||||
if (target == null) {
|
||||
throw new IllegalArgumentException("target object must not be null");
|
||||
|
@ -564,7 +564,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if <code>target</code> or <code>fieldName</code> is null
|
||||
* @throws IllegalAccessException if the field is not made accessible
|
||||
*/
|
||||
public static void writeDeclaredField(Object target, String fieldName, Object value) throws IllegalAccessException {
|
||||
public static void writeDeclaredField(final Object target, final String fieldName, final Object value) throws IllegalAccessException {
|
||||
writeDeclaredField(target, fieldName, value, false);
|
||||
}
|
||||
|
||||
|
@ -579,7 +579,7 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException if <code>target</code> or <code>fieldName</code> is null
|
||||
* @throws IllegalAccessException if the field is not made accessible
|
||||
*/
|
||||
public static void writeDeclaredField(Object target, String fieldName, Object value, boolean forceAccess)
|
||||
public static void writeDeclaredField(final Object target, final String fieldName, final Object value, final boolean forceAccess)
|
||||
throws IllegalAccessException {
|
||||
if (target == null) {
|
||||
throw new IllegalArgumentException("target object must not be null");
|
||||
|
|
|
@ -51,7 +51,7 @@ abstract class MemberUtils {
|
|||
* accepted.
|
||||
* @param o the AccessibleObject to set as accessible
|
||||
*/
|
||||
static void setAccessibleWorkaround(AccessibleObject o) {
|
||||
static void setAccessibleWorkaround(final AccessibleObject o) {
|
||||
if (o == null || o.isAccessible()) {
|
||||
return;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ abstract class MemberUtils {
|
|||
* @param modifiers to test
|
||||
* @return true unless package/protected/private modifier detected
|
||||
*/
|
||||
static boolean isPackageAccess(int modifiers) {
|
||||
static boolean isPackageAccess(final int modifiers) {
|
||||
return (modifiers & ACCESS_TEST) == 0;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ abstract class MemberUtils {
|
|||
* @param m Member to check
|
||||
* @return true if <code>m</code> is accessible
|
||||
*/
|
||||
static boolean isAccessible(Member m) {
|
||||
static boolean isAccessible(final Member m) {
|
||||
return m != null && Modifier.isPublic(m.getModifiers()) && !m.isSynthetic();
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ abstract class MemberUtils {
|
|||
* <code>left</code>/<code>right</code>
|
||||
* @return int consistent with <code>compare</code> semantics
|
||||
*/
|
||||
static int compareParameterTypes(Class<?>[] left, Class<?>[] right, Class<?>[] actual) {
|
||||
static int compareParameterTypes(final Class<?>[] left, final Class<?>[] right, final Class<?>[] actual) {
|
||||
float leftCost = getTotalTransformationCost(actual, left);
|
||||
float rightCost = getTotalTransformationCost(actual, right);
|
||||
return leftCost < rightCost ? -1 : rightCost < leftCost ? 1 : 0;
|
||||
|
@ -109,7 +109,7 @@ abstract class MemberUtils {
|
|||
* @param destArgs The destination arguments
|
||||
* @return The total transformation cost
|
||||
*/
|
||||
private static float getTotalTransformationCost(Class<?>[] srcArgs, Class<?>[] destArgs) {
|
||||
private static float getTotalTransformationCost(final Class<?>[] srcArgs, final Class<?>[] destArgs) {
|
||||
float totalCost = 0.0f;
|
||||
for (int i = 0; i < srcArgs.length; i++) {
|
||||
Class<?> srcClass, destClass;
|
||||
|
@ -128,7 +128,7 @@ abstract class MemberUtils {
|
|||
* @param destClass The destination class
|
||||
* @return The cost of transforming an object
|
||||
*/
|
||||
private static float getObjectTransformationCost(Class<?> srcClass, Class<?> destClass) {
|
||||
private static float getObjectTransformationCost(Class<?> srcClass, final Class<?> destClass) {
|
||||
if (destClass.isPrimitive()) {
|
||||
return getPrimitivePromotionCost(srcClass, destClass);
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class MethodUtils {
|
|||
* @throws InvocationTargetException wraps an exception thrown by the method invoked
|
||||
* @throws IllegalAccessException if the requested method is not accessible via reflection
|
||||
*/
|
||||
public static Object invokeMethod(Object object, String methodName,
|
||||
public static Object invokeMethod(final Object object, final String methodName,
|
||||
Object... args) throws NoSuchMethodException,
|
||||
IllegalAccessException, InvocationTargetException {
|
||||
if (args == null) {
|
||||
|
@ -109,7 +109,7 @@ public class MethodUtils {
|
|||
* @throws InvocationTargetException wraps an exception thrown by the method invoked
|
||||
* @throws IllegalAccessException if the requested method is not accessible via reflection
|
||||
*/
|
||||
public static Object invokeMethod(Object object, String methodName,
|
||||
public static Object invokeMethod(final Object object, final String methodName,
|
||||
Object[] args, Class<?>[] parameterTypes)
|
||||
throws NoSuchMethodException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
|
@ -147,7 +147,7 @@ public class MethodUtils {
|
|||
* @throws IllegalAccessException if the requested method is not accessible
|
||||
* via reflection
|
||||
*/
|
||||
public static Object invokeExactMethod(Object object, String methodName,
|
||||
public static Object invokeExactMethod(final Object object, final String methodName,
|
||||
Object... args) throws NoSuchMethodException,
|
||||
IllegalAccessException, InvocationTargetException {
|
||||
if (args == null) {
|
||||
|
@ -176,7 +176,7 @@ public class MethodUtils {
|
|||
* @throws IllegalAccessException if the requested method is not accessible
|
||||
* via reflection
|
||||
*/
|
||||
public static Object invokeExactMethod(Object object, String methodName,
|
||||
public static Object invokeExactMethod(final Object object, final String methodName,
|
||||
Object[] args, Class<?>[] parameterTypes)
|
||||
throws NoSuchMethodException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
|
@ -215,7 +215,7 @@ public class MethodUtils {
|
|||
* @throws IllegalAccessException if the requested method is not accessible
|
||||
* via reflection
|
||||
*/
|
||||
public static Object invokeExactStaticMethod(Class<?> cls, String methodName,
|
||||
public static Object invokeExactStaticMethod(final Class<?> cls, final String methodName,
|
||||
Object[] args, Class<?>[] parameterTypes)
|
||||
throws NoSuchMethodException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
|
@ -257,7 +257,7 @@ public class MethodUtils {
|
|||
* @throws IllegalAccessException if the requested method is not accessible
|
||||
* via reflection
|
||||
*/
|
||||
public static Object invokeStaticMethod(Class<?> cls, String methodName,
|
||||
public static Object invokeStaticMethod(final Class<?> cls, final String methodName,
|
||||
Object... args) throws NoSuchMethodException,
|
||||
IllegalAccessException, InvocationTargetException {
|
||||
if (args == null) {
|
||||
|
@ -289,7 +289,7 @@ public class MethodUtils {
|
|||
* @throws IllegalAccessException if the requested method is not accessible
|
||||
* via reflection
|
||||
*/
|
||||
public static Object invokeStaticMethod(Class<?> cls, String methodName,
|
||||
public static Object invokeStaticMethod(final Class<?> cls, final String methodName,
|
||||
Object[] args, Class<?>[] parameterTypes)
|
||||
throws NoSuchMethodException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
|
@ -326,7 +326,7 @@ public class MethodUtils {
|
|||
* @throws IllegalAccessException if the requested method is not accessible
|
||||
* via reflection
|
||||
*/
|
||||
public static Object invokeExactStaticMethod(Class<?> cls, String methodName,
|
||||
public static Object invokeExactStaticMethod(final Class<?> cls, final String methodName,
|
||||
Object... args) throws NoSuchMethodException,
|
||||
IllegalAccessException, InvocationTargetException {
|
||||
if (args == null) {
|
||||
|
@ -348,8 +348,8 @@ public class MethodUtils {
|
|||
* @param parameterTypes with these parameters types
|
||||
* @return The accessible method
|
||||
*/
|
||||
public static Method getAccessibleMethod(Class<?> cls, String methodName,
|
||||
Class<?>... parameterTypes) {
|
||||
public static Method getAccessibleMethod(final Class<?> cls, final String methodName,
|
||||
final Class<?>... parameterTypes) {
|
||||
try {
|
||||
return getAccessibleMethod(cls.getMethod(methodName,
|
||||
parameterTypes));
|
||||
|
@ -400,8 +400,8 @@ public class MethodUtils {
|
|||
* @param parameterTypes The parameter type signatures
|
||||
* @return the accessible method or <code>null</code> if not found
|
||||
*/
|
||||
private static Method getAccessibleMethodFromSuperclass(Class<?> cls,
|
||||
String methodName, Class<?>... parameterTypes) {
|
||||
private static Method getAccessibleMethodFromSuperclass(final Class<?> cls,
|
||||
final String methodName, final Class<?>... parameterTypes) {
|
||||
Class<?> parentClass = cls.getSuperclass();
|
||||
while (parentClass != null) {
|
||||
if (Modifier.isPublic(parentClass.getModifiers())) {
|
||||
|
@ -432,7 +432,7 @@ public class MethodUtils {
|
|||
* @return the accessible method or <code>null</code> if not found
|
||||
*/
|
||||
private static Method getAccessibleMethodFromInterfaceNest(Class<?> cls,
|
||||
String methodName, Class<?>... parameterTypes) {
|
||||
final String methodName, final Class<?>... parameterTypes) {
|
||||
Method method = null;
|
||||
|
||||
// Search up the superclass chain
|
||||
|
@ -489,8 +489,8 @@ public class MethodUtils {
|
|||
* @param parameterTypes find method with most compatible parameters
|
||||
* @return The accessible method
|
||||
*/
|
||||
public static Method getMatchingAccessibleMethod(Class<?> cls,
|
||||
String methodName, Class<?>... parameterTypes) {
|
||||
public static Method getMatchingAccessibleMethod(final Class<?> cls,
|
||||
final String methodName, final Class<?>... parameterTypes) {
|
||||
try {
|
||||
Method method = cls.getMethod(methodName, parameterTypes);
|
||||
MemberUtils.setAccessibleWorkaround(method);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class TypeUtils {
|
|||
* @param toType the target type
|
||||
* @return <code>true</code> if <code>type</code> is assignable to <code>toType</code>.
|
||||
*/
|
||||
public static boolean isAssignable(Type type, Type toType) {
|
||||
public static boolean isAssignable(final Type type, final Type toType) {
|
||||
return isAssignable(type, toType, null);
|
||||
}
|
||||
|
||||
|
@ -74,8 +74,8 @@ public class TypeUtils {
|
|||
* @param typeVarAssigns optional map of type variable assignments
|
||||
* @return <code>true</code> if <code>type</code> is assignable to <code>toType</code>.
|
||||
*/
|
||||
private static boolean isAssignable(Type type, Type toType,
|
||||
Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
private static boolean isAssignable(final Type type, final Type toType,
|
||||
final Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
if (toType == null || toType instanceof Class<?>) {
|
||||
return isAssignable(type, (Class<?>) toType);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class TypeUtils {
|
|||
* @param toClass the target class
|
||||
* @return true if <code>type</code> is assignable to <code>toClass</code>.
|
||||
*/
|
||||
private static boolean isAssignable(Type type, Class<?> toClass) {
|
||||
private static boolean isAssignable(final Type type, final Class<?> toClass) {
|
||||
if (type == null) {
|
||||
// consistency with ClassUtils.isAssignable() behavior
|
||||
return toClass == null || !toClass.isPrimitive();
|
||||
|
@ -176,8 +176,8 @@ public class TypeUtils {
|
|||
* @param typeVarAssigns a map with type variables
|
||||
* @return true if <code>type</code> is assignable to <code>toType</code>.
|
||||
*/
|
||||
private static boolean isAssignable(Type type, ParameterizedType toParameterizedType,
|
||||
Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
private static boolean isAssignable(final Type type, final ParameterizedType toParameterizedType,
|
||||
final Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
if (type == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class TypeUtils {
|
|||
return true;
|
||||
}
|
||||
|
||||
private static Type unrollVariableAssignments(TypeVariable<?> var, Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
private static Type unrollVariableAssignments(TypeVariable<?> var, final Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
Type result;
|
||||
do {
|
||||
result = typeVarAssigns.get(var);
|
||||
|
@ -257,8 +257,8 @@ public class TypeUtils {
|
|||
* @return true if <code>type</code> is assignable to
|
||||
* <code>toGenericArrayType</code>.
|
||||
*/
|
||||
private static boolean isAssignable(Type type, GenericArrayType toGenericArrayType,
|
||||
Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
private static boolean isAssignable(final Type type, final GenericArrayType toGenericArrayType,
|
||||
final Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
if (type == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -333,8 +333,8 @@ public class TypeUtils {
|
|||
* @return true if <code>type</code> is assignable to
|
||||
* <code>toWildcardType</code>.
|
||||
*/
|
||||
private static boolean isAssignable(Type type, WildcardType toWildcardType,
|
||||
Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
private static boolean isAssignable(final Type type, final WildcardType toWildcardType,
|
||||
final Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
if (type == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -422,8 +422,8 @@ public class TypeUtils {
|
|||
* @return true if <code>type</code> is assignable to
|
||||
* <code>toTypeVariable</code>.
|
||||
*/
|
||||
private static boolean isAssignable(Type type, TypeVariable<?> toTypeVariable,
|
||||
Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
private static boolean isAssignable(final Type type, final TypeVariable<?> toTypeVariable,
|
||||
final Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
if (type == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ public class TypeUtils {
|
|||
* @return the replaced type
|
||||
* @throws IllegalArgumentException if the type cannot be substituted
|
||||
*/
|
||||
private static Type substituteTypeVariables(Type type, Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
private static Type substituteTypeVariables(final Type type, final Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
if (type instanceof TypeVariable<?> && typeVarAssigns != null) {
|
||||
Type replacementType = typeVarAssigns.get(type);
|
||||
|
||||
|
@ -494,7 +494,7 @@ public class TypeUtils {
|
|||
* harvest the parameters.
|
||||
* @return a map of the type arguments to their respective type variables.
|
||||
*/
|
||||
public static Map<TypeVariable<?>, Type> getTypeArguments(ParameterizedType type) {
|
||||
public static Map<TypeVariable<?>, Type> getTypeArguments(final ParameterizedType type) {
|
||||
return getTypeArguments(type, getRawType(type), null);
|
||||
}
|
||||
|
||||
|
@ -530,7 +530,7 @@ public class TypeUtils {
|
|||
* in the inheritance hierarchy from <code>type</code> to
|
||||
* <code>toClass</code> inclusive.
|
||||
*/
|
||||
public static Map<TypeVariable<?>, Type> getTypeArguments(Type type, Class<?> toClass) {
|
||||
public static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass) {
|
||||
return getTypeArguments(type, toClass, null);
|
||||
}
|
||||
|
||||
|
@ -542,8 +542,8 @@ public class TypeUtils {
|
|||
* @param subtypeVarAssigns a map with type variables
|
||||
* @return the map with type arguments
|
||||
*/
|
||||
private static Map<TypeVariable<?>, Type> getTypeArguments(Type type, Class<?> toClass,
|
||||
Map<TypeVariable<?>, Type> subtypeVarAssigns) {
|
||||
private static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass,
|
||||
final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
|
||||
if (type instanceof Class<?>) {
|
||||
return getTypeArguments((Class<?>) type, toClass, subtypeVarAssigns);
|
||||
}
|
||||
|
@ -595,8 +595,8 @@ public class TypeUtils {
|
|||
* @return the map with type arguments
|
||||
*/
|
||||
private static Map<TypeVariable<?>, Type> getTypeArguments(
|
||||
ParameterizedType parameterizedType, Class<?> toClass,
|
||||
Map<TypeVariable<?>, Type> subtypeVarAssigns) {
|
||||
final ParameterizedType parameterizedType, final Class<?> toClass,
|
||||
final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
|
||||
Class<?> cls = getRawType(parameterizedType);
|
||||
|
||||
// make sure they're assignable
|
||||
|
@ -647,8 +647,8 @@ public class TypeUtils {
|
|||
* @param subtypeVarAssigns a map with type variables
|
||||
* @return the map with type arguments
|
||||
*/
|
||||
private static Map<TypeVariable<?>, Type> getTypeArguments(Class<?> cls, Class<?> toClass,
|
||||
Map<TypeVariable<?>, Type> subtypeVarAssigns) {
|
||||
private static Map<TypeVariable<?>, Type> getTypeArguments(Class<?> cls, final Class<?> toClass,
|
||||
final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
|
||||
// make sure they're assignable
|
||||
if (!isAssignable(cls, toClass)) {
|
||||
return null;
|
||||
|
@ -707,8 +707,8 @@ public class TypeUtils {
|
|||
* type variables in each type in the inheritance hierarchy from
|
||||
* <code>type</code> to <code>toClass</code> inclusive.
|
||||
*/
|
||||
public static Map<TypeVariable<?>, Type> determineTypeArguments(Class<?> cls,
|
||||
ParameterizedType superType) {
|
||||
public static Map<TypeVariable<?>, Type> determineTypeArguments(final Class<?> cls,
|
||||
final ParameterizedType superType) {
|
||||
Class<?> superClass = getRawType(superType);
|
||||
|
||||
// compatibility check
|
||||
|
@ -747,8 +747,8 @@ public class TypeUtils {
|
|||
* @param parameterizedType the parameterized type
|
||||
* @param typeVarAssigns the map to be filled
|
||||
*/
|
||||
private static <T> void mapTypeVariablesToArguments(Class<T> cls,
|
||||
ParameterizedType parameterizedType, Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
private static <T> void mapTypeVariablesToArguments(final Class<T> cls,
|
||||
final ParameterizedType parameterizedType, final Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
// capture the type variables from the owner type that have assignments
|
||||
Type ownerType = parameterizedType.getOwnerType();
|
||||
|
||||
|
@ -794,7 +794,7 @@ public class TypeUtils {
|
|||
* @param superClass the super class
|
||||
* @return the closes parent type
|
||||
*/
|
||||
private static Type getClosestParentType(Class<?> cls, Class<?> superClass) {
|
||||
private static Type getClosestParentType(final Class<?> cls, final Class<?> superClass) {
|
||||
// only look at the interfaces if the super class is also an interface
|
||||
if (superClass.isInterface()) {
|
||||
// get the generic interfaces of the subject class
|
||||
|
@ -842,7 +842,7 @@ public class TypeUtils {
|
|||
* @param type the target type
|
||||
* @return true of <code>value</code> is an instance of <code>type</code>.
|
||||
*/
|
||||
public static boolean isInstance(Object value, Type type) {
|
||||
public static boolean isInstance(final Object value, final Type type) {
|
||||
if (type == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -872,7 +872,7 @@ public class TypeUtils {
|
|||
* @return an array containing the values from <code>bounds</code> minus the
|
||||
* redundant types.
|
||||
*/
|
||||
public static Type[] normalizeUpperBounds(Type[] bounds) {
|
||||
public static Type[] normalizeUpperBounds(final Type[] bounds) {
|
||||
// don't bother if there's only one (or none) type
|
||||
if (bounds.length < 2) {
|
||||
return bounds;
|
||||
|
@ -907,7 +907,7 @@ public class TypeUtils {
|
|||
* @param typeVariable the subject type variable
|
||||
* @return a non-empty array containing the bounds of the type variable.
|
||||
*/
|
||||
public static Type[] getImplicitBounds(TypeVariable<?> typeVariable) {
|
||||
public static Type[] getImplicitBounds(final TypeVariable<?> typeVariable) {
|
||||
Type[] bounds = typeVariable.getBounds();
|
||||
|
||||
return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
|
||||
|
@ -923,7 +923,7 @@ public class TypeUtils {
|
|||
* @return a non-empty array containing the upper bounds of the wildcard
|
||||
* type.
|
||||
*/
|
||||
public static Type[] getImplicitUpperBounds(WildcardType wildcardType) {
|
||||
public static Type[] getImplicitUpperBounds(final WildcardType wildcardType) {
|
||||
Type[] bounds = wildcardType.getUpperBounds();
|
||||
|
||||
return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
|
||||
|
@ -938,7 +938,7 @@ public class TypeUtils {
|
|||
* @return a non-empty array containing the lower bounds of the wildcard
|
||||
* type.
|
||||
*/
|
||||
public static Type[] getImplicitLowerBounds(WildcardType wildcardType) {
|
||||
public static Type[] getImplicitLowerBounds(final WildcardType wildcardType) {
|
||||
Type[] bounds = wildcardType.getLowerBounds();
|
||||
|
||||
return bounds.length == 0 ? new Type[] { null } : bounds;
|
||||
|
@ -957,7 +957,7 @@ public class TypeUtils {
|
|||
* @return whether or not the types can be assigned to their respective type
|
||||
* variables.
|
||||
*/
|
||||
public static boolean typesSatisfyVariables(Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
public static boolean typesSatisfyVariables(final Map<TypeVariable<?>, Type> typeVarAssigns) {
|
||||
// all types must be assignable to all the bounds of the their mapped
|
||||
// type variable.
|
||||
for (Map.Entry<TypeVariable<?>, Type> entry : typeVarAssigns.entrySet()) {
|
||||
|
@ -982,7 +982,7 @@ public class TypeUtils {
|
|||
* @return the corresponding {@code Class} object
|
||||
* @throws IllegalStateException if the conversion fails
|
||||
*/
|
||||
private static Class<?> getRawType(ParameterizedType parameterizedType) {
|
||||
private static Class<?> getRawType(final ParameterizedType parameterizedType) {
|
||||
Type rawType = parameterizedType.getRawType();
|
||||
|
||||
// check if raw type is a Class object
|
||||
|
@ -1009,7 +1009,7 @@ public class TypeUtils {
|
|||
* @return the resolved <code>Class</code> object or <code>null</code> if
|
||||
* the type could not be resolved
|
||||
*/
|
||||
public static Class<?> getRawType(Type type, Type assigningType) {
|
||||
public static Class<?> getRawType(final Type type, final Type assigningType) {
|
||||
if (type instanceof Class<?>) {
|
||||
// it is raw, no problem
|
||||
return (Class<?>) type;
|
||||
|
@ -1078,7 +1078,7 @@ public class TypeUtils {
|
|||
* @param type the type to be checked
|
||||
* @return <code>true</code> if <code>type</code> is an array class or a {@link GenericArrayType}.
|
||||
*/
|
||||
public static boolean isArrayType(Type type) {
|
||||
public static boolean isArrayType(final Type type) {
|
||||
return type instanceof GenericArrayType || type instanceof Class<?> && ((Class<?>) type).isArray();
|
||||
}
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ public class TypeUtils {
|
|||
* @param type the type to be checked
|
||||
* @return component type or null if type is not an array type
|
||||
*/
|
||||
public static Type getArrayComponentType(Type type) {
|
||||
public static Type getArrayComponentType(final Type type) {
|
||||
if (type instanceof Class<?>) {
|
||||
Class<?> clazz = (Class<?>) type;
|
||||
return clazz.isArray() ? clazz.getComponentType() : null;
|
||||
|
|
|
@ -49,7 +49,7 @@ public class CompositeFormat extends Format {
|
|||
* @param parser implementation
|
||||
* @param formatter implementation
|
||||
*/
|
||||
public CompositeFormat(Format parser, Format formatter) {
|
||||
public CompositeFormat(final Format parser, final Format formatter) {
|
||||
this.parser = parser;
|
||||
this.formatter = formatter;
|
||||
}
|
||||
|
@ -64,8 +64,8 @@ public class CompositeFormat extends Format {
|
|||
* @see Format#format(Object, StringBuffer, FieldPosition)
|
||||
*/
|
||||
@Override // Therefore has to use StringBuffer
|
||||
public StringBuffer format(Object obj, StringBuffer toAppendTo,
|
||||
FieldPosition pos) {
|
||||
public StringBuffer format(final Object obj, final StringBuffer toAppendTo,
|
||||
final FieldPosition pos) {
|
||||
return formatter.format(obj, toAppendTo, pos);
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class CompositeFormat extends Format {
|
|||
* @see Format#parseObject(String, ParsePosition)
|
||||
*/
|
||||
@Override
|
||||
public Object parseObject(String source, ParsePosition pos) {
|
||||
public Object parseObject(final String source, final ParsePosition pos) {
|
||||
return parser.parseObject(source, pos);
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class CompositeFormat extends Format {
|
|||
* @return A reformatted String
|
||||
* @throws ParseException thrown by parseObject(String) call
|
||||
*/
|
||||
public String reformat(String input) throws ParseException {
|
||||
public String reformat(final String input) throws ParseException {
|
||||
return format(parseObject(input));
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param pattern the pattern to use, not null
|
||||
* @throws IllegalArgumentException in case of a bad pattern.
|
||||
*/
|
||||
public ExtendedMessageFormat(String pattern) {
|
||||
public ExtendedMessageFormat(final String pattern) {
|
||||
this(pattern, Locale.getDefault());
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param locale the locale to use, not null
|
||||
* @throws IllegalArgumentException in case of a bad pattern.
|
||||
*/
|
||||
public ExtendedMessageFormat(String pattern, Locale locale) {
|
||||
public ExtendedMessageFormat(final String pattern, final Locale locale) {
|
||||
this(pattern, locale, null);
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param registry the registry of format factories, may be null
|
||||
* @throws IllegalArgumentException in case of a bad pattern.
|
||||
*/
|
||||
public ExtendedMessageFormat(String pattern, Map<String, ? extends FormatFactory> registry) {
|
||||
public ExtendedMessageFormat(final String pattern, final Map<String, ? extends FormatFactory> registry) {
|
||||
this(pattern, Locale.getDefault(), registry);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param registry the registry of format factories, may be null
|
||||
* @throws IllegalArgumentException in case of a bad pattern.
|
||||
*/
|
||||
public ExtendedMessageFormat(String pattern, Locale locale, Map<String, ? extends FormatFactory> registry) {
|
||||
public ExtendedMessageFormat(final String pattern, final Locale locale, final Map<String, ? extends FormatFactory> registry) {
|
||||
super(DUMMY_PATTERN);
|
||||
setLocale(locale);
|
||||
this.registry = registry;
|
||||
|
@ -142,7 +142,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param pattern String
|
||||
*/
|
||||
@Override
|
||||
public final void applyPattern(String pattern) {
|
||||
public final void applyPattern(final String pattern) {
|
||||
if (registry == null) {
|
||||
super.applyPattern(pattern);
|
||||
toPattern = super.toPattern();
|
||||
|
@ -216,7 +216,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @throws UnsupportedOperationException
|
||||
*/
|
||||
@Override
|
||||
public void setFormat(int formatElementIndex, Format newFormat) {
|
||||
public void setFormat(final int formatElementIndex, final Format newFormat) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @throws UnsupportedOperationException
|
||||
*/
|
||||
@Override
|
||||
public void setFormatByArgumentIndex(int argumentIndex, Format newFormat) {
|
||||
public void setFormatByArgumentIndex(final int argumentIndex, final Format newFormat) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @throws UnsupportedOperationException
|
||||
*/
|
||||
@Override
|
||||
public void setFormats(Format[] newFormats) {
|
||||
public void setFormats(final Format[] newFormats) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @throws UnsupportedOperationException
|
||||
*/
|
||||
@Override
|
||||
public void setFormatsByArgumentIndex(Format[] newFormats) {
|
||||
public void setFormatsByArgumentIndex(final Format[] newFormats) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @return true if this object equals the other, otherwise false
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param desc String
|
||||
* @return Format
|
||||
*/
|
||||
private Format getFormat(String desc) {
|
||||
private Format getFormat(final String desc) {
|
||||
if (registry != null) {
|
||||
String name = desc;
|
||||
String args = null;
|
||||
|
@ -327,7 +327,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param pos current parse position
|
||||
* @return argument index
|
||||
*/
|
||||
private int readArgumentIndex(String pattern, ParsePosition pos) {
|
||||
private int readArgumentIndex(final String pattern, final ParsePosition pos) {
|
||||
int start = pos.getIndex();
|
||||
seekNonWs(pattern, pos);
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
@ -369,7 +369,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param pos current parse position
|
||||
* @return Format description String
|
||||
*/
|
||||
private String parseFormatDescription(String pattern, ParsePosition pos) {
|
||||
private String parseFormatDescription(final String pattern, final ParsePosition pos) {
|
||||
int start = pos.getIndex();
|
||||
seekNonWs(pattern, pos);
|
||||
int text = pos.getIndex();
|
||||
|
@ -401,7 +401,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param customPatterns The custom patterns to re-insert, if any
|
||||
* @return full pattern
|
||||
*/
|
||||
private String insertFormats(String pattern, ArrayList<String> customPatterns) {
|
||||
private String insertFormats(final String pattern, final ArrayList<String> customPatterns) {
|
||||
if (!containsElements(customPatterns)) {
|
||||
return pattern;
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param pattern String to read
|
||||
* @param pos current position
|
||||
*/
|
||||
private void seekNonWs(String pattern, ParsePosition pos) {
|
||||
private void seekNonWs(final String pattern, final ParsePosition pos) {
|
||||
int len = 0;
|
||||
char[] buffer = pattern.toCharArray();
|
||||
do {
|
||||
|
@ -459,7 +459,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param pos ParsePosition
|
||||
* @return <code>pos</code>
|
||||
*/
|
||||
private ParsePosition next(ParsePosition pos) {
|
||||
private ParsePosition next(final ParsePosition pos) {
|
||||
pos.setIndex(pos.getIndex() + 1);
|
||||
return pos;
|
||||
}
|
||||
|
@ -474,8 +474,8 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param escapingOn whether to process escaped quotes
|
||||
* @return <code>appendTo</code>
|
||||
*/
|
||||
private StringBuilder appendQuotedString(String pattern, ParsePosition pos,
|
||||
StringBuilder appendTo, boolean escapingOn) {
|
||||
private StringBuilder appendQuotedString(final String pattern, final ParsePosition pos,
|
||||
final StringBuilder appendTo, final boolean escapingOn) {
|
||||
int start = pos.getIndex();
|
||||
char[] c = pattern.toCharArray();
|
||||
if (escapingOn && c[start] == QUOTE) {
|
||||
|
@ -511,8 +511,8 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param pos current parse position
|
||||
* @param escapingOn whether to process escaped quotes
|
||||
*/
|
||||
private void getQuotedString(String pattern, ParsePosition pos,
|
||||
boolean escapingOn) {
|
||||
private void getQuotedString(final String pattern, final ParsePosition pos,
|
||||
final boolean escapingOn) {
|
||||
appendQuotedString(pattern, pos, null, escapingOn);
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
|||
* @param coll to check
|
||||
* @return <code>true</code> if some Object was found, <code>false</code> otherwise.
|
||||
*/
|
||||
private boolean containsElements(Collection<?> coll) {
|
||||
private boolean containsElements(final Collection<?> coll) {
|
||||
if (coll == null || coll.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class FormattableUtils {
|
|||
* @param formattable the instance to convert to a string, not null
|
||||
* @return the resulting string, not null
|
||||
*/
|
||||
public static String toString(Formattable formattable) {
|
||||
public static String toString(final Formattable formattable) {
|
||||
return String.format(SIMPLEST_FORMAT, formattable);
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ public class FormattableUtils {
|
|||
* @param precision the precision of the output, see {@code Formattable}
|
||||
* @return the {@code formatter} instance, not null
|
||||
*/
|
||||
public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width,
|
||||
int precision) {
|
||||
public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
|
||||
final int precision) {
|
||||
return append(seq, formatter, flags, width, precision, ' ', null);
|
||||
}
|
||||
|
||||
|
@ -95,8 +95,8 @@ public class FormattableUtils {
|
|||
* @param padChar the pad character to use
|
||||
* @return the {@code formatter} instance, not null
|
||||
*/
|
||||
public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width,
|
||||
int precision, char padChar) {
|
||||
public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
|
||||
final int precision, final char padChar) {
|
||||
return append(seq, formatter, flags, width, precision, padChar, null);
|
||||
}
|
||||
|
||||
|
@ -113,8 +113,8 @@ public class FormattableUtils {
|
|||
* empty causes a hard truncation
|
||||
* @return the {@code formatter} instance, not null
|
||||
*/
|
||||
public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width,
|
||||
int precision, CharSequence ellipsis) {
|
||||
public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
|
||||
final int precision, final CharSequence ellipsis) {
|
||||
return append(seq, formatter, flags, width, precision, ' ', ellipsis);
|
||||
}
|
||||
|
||||
|
@ -131,8 +131,8 @@ public class FormattableUtils {
|
|||
* empty causes a hard truncation
|
||||
* @return the {@code formatter} instance, not null
|
||||
*/
|
||||
public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width,
|
||||
int precision, char padChar, CharSequence ellipsis) {
|
||||
public static Formatter append(final CharSequence seq, final Formatter formatter, final int flags, final int width,
|
||||
final int precision, final char padChar, final CharSequence ellipsis) {
|
||||
Validate.isTrue(ellipsis == null || precision < 0 || ellipsis.length() <= precision,
|
||||
"Specified ellipsis '%1$s' exceeds precision of %2$s", ellipsis, Integer.valueOf(precision));
|
||||
StringBuilder buf = new StringBuilder(seq);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -93,7 +93,7 @@ public abstract class StrLookup<V> {
|
|||
* @param map the map of keys to values, may be null
|
||||
* @return a lookup using the map, not null
|
||||
*/
|
||||
public static <V> StrLookup<V> mapLookup(Map<String, V> map) {
|
||||
public static <V> StrLookup<V> mapLookup(final Map<String, V> map) {
|
||||
return new MapStrLookup<V>(map);
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public abstract class StrLookup<V> {
|
|||
*
|
||||
* @param map the map of keys to values, may be null
|
||||
*/
|
||||
MapStrLookup(Map<String, V> map) {
|
||||
MapStrLookup(final Map<String, V> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ public abstract class StrLookup<V> {
|
|||
* @return the matching value, null if no match
|
||||
*/
|
||||
@Override
|
||||
public String lookup(String key) {
|
||||
public String lookup(final String key) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ public abstract class StrMatcher {
|
|||
* @param ch the character to match, must not be null
|
||||
* @return a new Matcher for the given char
|
||||
*/
|
||||
public static StrMatcher charMatcher(char ch) {
|
||||
public static StrMatcher charMatcher(final char ch) {
|
||||
return new CharMatcher(ch);
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public abstract class StrMatcher {
|
|||
* @param chars the characters to match, null or empty matches nothing
|
||||
* @return a new matcher for the given char[]
|
||||
*/
|
||||
public static StrMatcher charSetMatcher(char... chars) {
|
||||
public static StrMatcher charSetMatcher(final char... chars) {
|
||||
if (chars == null || chars.length == 0) {
|
||||
return NONE_MATCHER;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ public abstract class StrMatcher {
|
|||
* @param chars the characters to match, null or empty matches nothing
|
||||
* @return a new Matcher for the given characters
|
||||
*/
|
||||
public static StrMatcher charSetMatcher(String chars) {
|
||||
public static StrMatcher charSetMatcher(final String chars) {
|
||||
if (StringUtils.isEmpty(chars)) {
|
||||
return NONE_MATCHER;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ public abstract class StrMatcher {
|
|||
* @param str the string to match, null or empty matches nothing
|
||||
* @return a new Matcher for the given String
|
||||
*/
|
||||
public static StrMatcher stringMatcher(String str) {
|
||||
public static StrMatcher stringMatcher(final String str) {
|
||||
if (StringUtils.isEmpty(str)) {
|
||||
return NONE_MATCHER;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ public abstract class StrMatcher {
|
|||
* @return the number of matching characters, zero for no match
|
||||
* @since 2.4
|
||||
*/
|
||||
public int isMatch(char[] buffer, int pos) {
|
||||
public int isMatch(final char[] buffer, final int pos) {
|
||||
return isMatch(buffer, pos, 0, buffer.length);
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ public abstract class StrMatcher {
|
|||
*
|
||||
* @param chars the characters to match, must not be null
|
||||
*/
|
||||
CharSetMatcher(char chars[]) {
|
||||
CharSetMatcher(final char chars[]) {
|
||||
super();
|
||||
this.chars = chars.clone();
|
||||
Arrays.sort(this.chars);
|
||||
|
@ -297,7 +297,7 @@ public abstract class StrMatcher {
|
|||
* @return the number of matching characters, zero for no match
|
||||
*/
|
||||
@Override
|
||||
public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) {
|
||||
public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
|
||||
return Arrays.binarySearch(chars, buffer[pos]) >= 0 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ public abstract class StrMatcher {
|
|||
*
|
||||
* @param ch the character to match
|
||||
*/
|
||||
CharMatcher(char ch) {
|
||||
CharMatcher(final char ch) {
|
||||
super();
|
||||
this.ch = ch;
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ public abstract class StrMatcher {
|
|||
* @return the number of matching characters, zero for no match
|
||||
*/
|
||||
@Override
|
||||
public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) {
|
||||
public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
|
||||
return ch == buffer[pos] ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ public abstract class StrMatcher {
|
|||
*
|
||||
* @param str the string to match, must not be null
|
||||
*/
|
||||
StringMatcher(String str) {
|
||||
StringMatcher(final String str) {
|
||||
super();
|
||||
chars = str.toCharArray();
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ public abstract class StrMatcher {
|
|||
* @return the number of matching characters, zero for no match
|
||||
*/
|
||||
@Override
|
||||
public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) {
|
||||
public int isMatch(final char[] buffer, int pos, final int bufferStart, final int bufferEnd) {
|
||||
int len = chars.length;
|
||||
if (pos + len > bufferEnd) {
|
||||
return 0;
|
||||
|
@ -400,7 +400,7 @@ public abstract class StrMatcher {
|
|||
* @return the number of matching characters, zero for no match
|
||||
*/
|
||||
@Override
|
||||
public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) {
|
||||
public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ public abstract class StrMatcher {
|
|||
* @return the number of matching characters, zero for no match
|
||||
*/
|
||||
@Override
|
||||
public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) {
|
||||
public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
|
||||
return buffer[pos] <= 32 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ public class StrSubstitutor {
|
|||
* @param valueMap the map with the values, may be null
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public static <V> String replace(Object source, Map<String, V> valueMap) {
|
||||
public static <V> String replace(final Object source, final Map<String, V> valueMap) {
|
||||
return new StrSubstitutor(valueMap).replace(source);
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public class StrSubstitutor {
|
|||
* @return the result of the replace operation
|
||||
* @throws IllegalArgumentException if the prefix or suffix is null
|
||||
*/
|
||||
public static <V> String replace(Object source, Map<String, V> valueMap, String prefix, String suffix) {
|
||||
public static <V> String replace(final Object source, final Map<String, V> valueMap, final String prefix, final String suffix) {
|
||||
return new StrSubstitutor(valueMap, prefix, suffix).replace(source);
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class StrSubstitutor {
|
|||
* @param valueProperties the properties with values, may be null
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public static String replace(Object source, Properties valueProperties) {
|
||||
public static String replace(final Object source, final Properties valueProperties) {
|
||||
if (valueProperties == null) {
|
||||
return source.toString();
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ public class StrSubstitutor {
|
|||
* @param source the source text containing the variables to substitute, null returns null
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public static String replaceSystemProperties(Object source) {
|
||||
public static String replaceSystemProperties(final Object source) {
|
||||
return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ public class StrSubstitutor {
|
|||
* @param <V> the type of the values in the map
|
||||
* @param valueMap the map with the variables' values, may be null
|
||||
*/
|
||||
public <V> StrSubstitutor(Map<String, V> valueMap) {
|
||||
public <V> StrSubstitutor(final Map<String, V> valueMap) {
|
||||
this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ public class StrSubstitutor {
|
|||
* @param suffix the suffix for variables, not null
|
||||
* @throws IllegalArgumentException if the prefix or suffix is null
|
||||
*/
|
||||
public <V> StrSubstitutor(Map<String, V> valueMap, String prefix, String suffix) {
|
||||
public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix) {
|
||||
this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE);
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ public class StrSubstitutor {
|
|||
* @param escape the escape character
|
||||
* @throws IllegalArgumentException if the prefix or suffix is null
|
||||
*/
|
||||
public <V> StrSubstitutor(Map<String, V> valueMap, String prefix, String suffix, char escape) {
|
||||
public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape) {
|
||||
this(StrLookup.mapLookup(valueMap), prefix, suffix, escape);
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ public class StrSubstitutor {
|
|||
*
|
||||
* @param variableResolver the variable resolver, may be null
|
||||
*/
|
||||
public StrSubstitutor(StrLookup<?> variableResolver) {
|
||||
public StrSubstitutor(final StrLookup<?> variableResolver) {
|
||||
this(variableResolver, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ public class StrSubstitutor {
|
|||
* @param escape the escape character
|
||||
* @throws IllegalArgumentException if the prefix or suffix is null
|
||||
*/
|
||||
public StrSubstitutor(StrLookup<?> variableResolver, String prefix, String suffix, char escape) {
|
||||
public StrSubstitutor(final StrLookup<?> variableResolver, final String prefix, final String suffix, final char escape) {
|
||||
this.setVariableResolver(variableResolver);
|
||||
this.setVariablePrefix(prefix);
|
||||
this.setVariableSuffix(suffix);
|
||||
|
@ -282,7 +282,7 @@ public class StrSubstitutor {
|
|||
* @throws IllegalArgumentException if the prefix or suffix is null
|
||||
*/
|
||||
public StrSubstitutor(
|
||||
StrLookup<?> variableResolver, StrMatcher prefixMatcher, StrMatcher suffixMatcher, char escape) {
|
||||
final StrLookup<?> variableResolver, final StrMatcher prefixMatcher, final StrMatcher suffixMatcher, final char escape) {
|
||||
this.setVariableResolver(variableResolver);
|
||||
this.setVariablePrefixMatcher(prefixMatcher);
|
||||
this.setVariableSuffixMatcher(suffixMatcher);
|
||||
|
@ -297,7 +297,7 @@ public class StrSubstitutor {
|
|||
* @param source the string to replace in, null returns null
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public String replace(String source) {
|
||||
public String replace(final String source) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ public class StrSubstitutor {
|
|||
* @param length the length within the array to be processed, must be valid
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public String replace(String source, int offset, int length) {
|
||||
public String replace(final String source, final int offset, final int length) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ public class StrSubstitutor {
|
|||
* @param source the character array to replace in, not altered, null returns null
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public String replace(char[] source) {
|
||||
public String replace(final char[] source) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ public class StrSubstitutor {
|
|||
* @param length the length within the array to be processed, must be valid
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public String replace(char[] source, int offset, int length) {
|
||||
public String replace(final char[] source, final int offset, final int length) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ public class StrSubstitutor {
|
|||
* @param source the buffer to use as a template, not changed, null returns null
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public String replace(StringBuffer source) {
|
||||
public String replace(final StringBuffer source) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ public class StrSubstitutor {
|
|||
* @param length the length within the array to be processed, must be valid
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public String replace(StringBuffer source, int offset, int length) {
|
||||
public String replace(final StringBuffer source, final int offset, final int length) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ public class StrSubstitutor {
|
|||
* @param source the builder to use as a template, not changed, null returns null
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public String replace(StrBuilder source) {
|
||||
public String replace(final StrBuilder source) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ public class StrSubstitutor {
|
|||
* @param length the length within the array to be processed, must be valid
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public String replace(StrBuilder source, int offset, int length) {
|
||||
public String replace(final StrBuilder source, final int offset, final int length) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ public class StrSubstitutor {
|
|||
* @param source the source to replace in, null returns null
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public String replace(Object source) {
|
||||
public String replace(final Object source) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ public class StrSubstitutor {
|
|||
* @param source the buffer to replace in, updated, null returns zero
|
||||
* @return true if altered
|
||||
*/
|
||||
public boolean replaceIn(StringBuffer source) {
|
||||
public boolean replaceIn(final StringBuffer source) {
|
||||
if (source == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ public class StrSubstitutor {
|
|||
* @param length the length within the buffer to be processed, must be valid
|
||||
* @return true if altered
|
||||
*/
|
||||
public boolean replaceIn(StringBuffer source, int offset, int length) {
|
||||
public boolean replaceIn(final StringBuffer source, final int offset, final int length) {
|
||||
if (source == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ public class StrSubstitutor {
|
|||
* @param source the builder to replace in, updated, null returns zero
|
||||
* @return true if altered
|
||||
*/
|
||||
public boolean replaceIn(StrBuilder source) {
|
||||
public boolean replaceIn(final StrBuilder source) {
|
||||
if (source == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ public class StrSubstitutor {
|
|||
* @param length the length within the builder to be processed, must be valid
|
||||
* @return true if altered
|
||||
*/
|
||||
public boolean replaceIn(StrBuilder source, int offset, int length) {
|
||||
public boolean replaceIn(final StrBuilder source, final int offset, final int length) {
|
||||
if (source == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ public class StrSubstitutor {
|
|||
* @param length the length within the builder to be processed, must be valid
|
||||
* @return true if altered
|
||||
*/
|
||||
protected boolean substitute(StrBuilder buf, int offset, int length) {
|
||||
protected boolean substitute(final StrBuilder buf, final int offset, final int length) {
|
||||
return substitute(buf, offset, length, null) > 0;
|
||||
}
|
||||
|
||||
|
@ -575,7 +575,7 @@ public class StrSubstitutor {
|
|||
* @return the length change that occurs, unless priorVariables is null when the int
|
||||
* represents a boolean flag as to whether any change occurred.
|
||||
*/
|
||||
private int substitute(StrBuilder buf, int offset, int length, List<String> priorVariables) {
|
||||
private int substitute(final StrBuilder buf, final int offset, final int length, List<String> priorVariables) {
|
||||
StrMatcher prefixMatcher = getVariablePrefixMatcher();
|
||||
StrMatcher suffixMatcher = getVariableSuffixMatcher();
|
||||
char escape = getEscapeChar();
|
||||
|
@ -689,7 +689,7 @@ public class StrSubstitutor {
|
|||
* @param varName the variable name to check
|
||||
* @param priorVariables the list of prior variables
|
||||
*/
|
||||
private void checkCyclicSubstitution(String varName, List<String> priorVariables) {
|
||||
private void checkCyclicSubstitution(final String varName, final List<String> priorVariables) {
|
||||
if (priorVariables.contains(varName) == false) {
|
||||
return;
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ public class StrSubstitutor {
|
|||
* @param endPos the end position of the variable including the suffix, valid
|
||||
* @return the variable's value or <b>null</b> if the variable is unknown
|
||||
*/
|
||||
protected String resolveVariable(String variableName, StrBuilder buf, int startPos, int endPos) {
|
||||
protected String resolveVariable(final String variableName, final StrBuilder buf, final int startPos, final int endPos) {
|
||||
StrLookup<?> resolver = getVariableResolver();
|
||||
if (resolver == null) {
|
||||
return null;
|
||||
|
@ -744,7 +744,7 @@ public class StrSubstitutor {
|
|||
*
|
||||
* @param escapeCharacter the escape character (0 for disabling escaping)
|
||||
*/
|
||||
public void setEscapeChar(char escapeCharacter) {
|
||||
public void setEscapeChar(final char escapeCharacter) {
|
||||
this.escapeChar = escapeCharacter;
|
||||
}
|
||||
|
||||
|
@ -774,7 +774,7 @@ public class StrSubstitutor {
|
|||
* @return this, to enable chaining
|
||||
* @throws IllegalArgumentException if the prefix matcher is null
|
||||
*/
|
||||
public StrSubstitutor setVariablePrefixMatcher(StrMatcher prefixMatcher) {
|
||||
public StrSubstitutor setVariablePrefixMatcher(final StrMatcher prefixMatcher) {
|
||||
if (prefixMatcher == null) {
|
||||
throw new IllegalArgumentException("Variable prefix matcher must not be null!");
|
||||
}
|
||||
|
@ -792,7 +792,7 @@ public class StrSubstitutor {
|
|||
* @param prefix the prefix character to use
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrSubstitutor setVariablePrefix(char prefix) {
|
||||
public StrSubstitutor setVariablePrefix(final char prefix) {
|
||||
return setVariablePrefixMatcher(StrMatcher.charMatcher(prefix));
|
||||
}
|
||||
|
||||
|
@ -806,7 +806,7 @@ public class StrSubstitutor {
|
|||
* @return this, to enable chaining
|
||||
* @throws IllegalArgumentException if the prefix is null
|
||||
*/
|
||||
public StrSubstitutor setVariablePrefix(String prefix) {
|
||||
public StrSubstitutor setVariablePrefix(final String prefix) {
|
||||
if (prefix == null) {
|
||||
throw new IllegalArgumentException("Variable prefix must not be null!");
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ public class StrSubstitutor {
|
|||
* @return this, to enable chaining
|
||||
* @throws IllegalArgumentException if the suffix matcher is null
|
||||
*/
|
||||
public StrSubstitutor setVariableSuffixMatcher(StrMatcher suffixMatcher) {
|
||||
public StrSubstitutor setVariableSuffixMatcher(final StrMatcher suffixMatcher) {
|
||||
if (suffixMatcher == null) {
|
||||
throw new IllegalArgumentException("Variable suffix matcher must not be null!");
|
||||
}
|
||||
|
@ -857,7 +857,7 @@ public class StrSubstitutor {
|
|||
* @param suffix the suffix character to use
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrSubstitutor setVariableSuffix(char suffix) {
|
||||
public StrSubstitutor setVariableSuffix(final char suffix) {
|
||||
return setVariableSuffixMatcher(StrMatcher.charMatcher(suffix));
|
||||
}
|
||||
|
||||
|
@ -871,7 +871,7 @@ public class StrSubstitutor {
|
|||
* @return this, to enable chaining
|
||||
* @throws IllegalArgumentException if the suffix is null
|
||||
*/
|
||||
public StrSubstitutor setVariableSuffix(String suffix) {
|
||||
public StrSubstitutor setVariableSuffix(final String suffix) {
|
||||
if (suffix == null) {
|
||||
throw new IllegalArgumentException("Variable suffix must not be null!");
|
||||
}
|
||||
|
@ -894,7 +894,7 @@ public class StrSubstitutor {
|
|||
*
|
||||
* @param variableResolver the VariableResolver
|
||||
*/
|
||||
public void setVariableResolver(StrLookup<?> variableResolver) {
|
||||
public void setVariableResolver(final StrLookup<?> variableResolver) {
|
||||
this.variableResolver = variableResolver;
|
||||
}
|
||||
|
||||
|
@ -920,7 +920,7 @@ public class StrSubstitutor {
|
|||
* @since 3.0
|
||||
*/
|
||||
public void setEnableSubstitutionInVariables(
|
||||
boolean enableSubstitutionInVariables) {
|
||||
final boolean enableSubstitutionInVariables) {
|
||||
this.enableSubstitutionInVariables = enableSubstitutionInVariables;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the text to parse
|
||||
* @return a new tokenizer instance which parses Comma Separated Value strings
|
||||
*/
|
||||
public static StrTokenizer getCSVInstance(String input) {
|
||||
public static StrTokenizer getCSVInstance(final String input) {
|
||||
StrTokenizer tok = getCSVClone();
|
||||
tok.reset(input);
|
||||
return tok;
|
||||
|
@ -176,7 +176,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the text to parse
|
||||
* @return a new tokenizer instance which parses Comma Separated Value strings
|
||||
*/
|
||||
public static StrTokenizer getCSVInstance(char[] input) {
|
||||
public static StrTokenizer getCSVInstance(final char[] input) {
|
||||
StrTokenizer tok = getCSVClone();
|
||||
tok.reset(input);
|
||||
return tok;
|
||||
|
@ -211,7 +211,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the string to parse
|
||||
* @return a new tokenizer instance which parses Tab Separated Value strings.
|
||||
*/
|
||||
public static StrTokenizer getTSVInstance(String input) {
|
||||
public static StrTokenizer getTSVInstance(final String input) {
|
||||
StrTokenizer tok = getTSVClone();
|
||||
tok.reset(input);
|
||||
return tok;
|
||||
|
@ -224,7 +224,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the string to parse
|
||||
* @return a new tokenizer instance which parses Tab Separated Value strings.
|
||||
*/
|
||||
public static StrTokenizer getTSVInstance(char[] input) {
|
||||
public static StrTokenizer getTSVInstance(final char[] input) {
|
||||
StrTokenizer tok = getTSVClone();
|
||||
tok.reset(input);
|
||||
return tok;
|
||||
|
@ -248,7 +248,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
*
|
||||
* @param input the string which is to be parsed
|
||||
*/
|
||||
public StrTokenizer(String input) {
|
||||
public StrTokenizer(final String input) {
|
||||
super();
|
||||
if (input != null) {
|
||||
chars = input.toCharArray();
|
||||
|
@ -263,7 +263,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the string which is to be parsed
|
||||
* @param delim the field delimiter character
|
||||
*/
|
||||
public StrTokenizer(String input, char delim) {
|
||||
public StrTokenizer(final String input, final char delim) {
|
||||
this(input);
|
||||
setDelimiterChar(delim);
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the string which is to be parsed
|
||||
* @param delim the field delimiter string
|
||||
*/
|
||||
public StrTokenizer(String input, String delim) {
|
||||
public StrTokenizer(final String input, final String delim) {
|
||||
this(input);
|
||||
setDelimiterString(delim);
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the string which is to be parsed
|
||||
* @param delim the field delimiter matcher
|
||||
*/
|
||||
public StrTokenizer(String input, StrMatcher delim) {
|
||||
public StrTokenizer(final String input, final StrMatcher delim) {
|
||||
this(input);
|
||||
setDelimiterMatcher(delim);
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param delim the field delimiter character
|
||||
* @param quote the field quoted string character
|
||||
*/
|
||||
public StrTokenizer(String input, char delim, char quote) {
|
||||
public StrTokenizer(final String input, final char delim, final char quote) {
|
||||
this(input, delim);
|
||||
setQuoteChar(quote);
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param delim the field delimiter matcher
|
||||
* @param quote the field quoted string matcher
|
||||
*/
|
||||
public StrTokenizer(String input, StrMatcher delim, StrMatcher quote) {
|
||||
public StrTokenizer(final String input, final StrMatcher delim, final StrMatcher quote) {
|
||||
this(input, delim);
|
||||
setQuoteMatcher(quote);
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
*
|
||||
* @param input the string which is to be parsed, not cloned
|
||||
*/
|
||||
public StrTokenizer(char[] input) {
|
||||
public StrTokenizer(final char[] input) {
|
||||
super();
|
||||
this.chars = ArrayUtils.clone(input);
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the string which is to be parsed, not cloned
|
||||
* @param delim the field delimiter character
|
||||
*/
|
||||
public StrTokenizer(char[] input, char delim) {
|
||||
public StrTokenizer(final char[] input, final char delim) {
|
||||
this(input);
|
||||
setDelimiterChar(delim);
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the string which is to be parsed, not cloned
|
||||
* @param delim the field delimiter string
|
||||
*/
|
||||
public StrTokenizer(char[] input, String delim) {
|
||||
public StrTokenizer(final char[] input, final String delim) {
|
||||
this(input);
|
||||
setDelimiterString(delim);
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the string which is to be parsed, not cloned
|
||||
* @param delim the field delimiter matcher
|
||||
*/
|
||||
public StrTokenizer(char[] input, StrMatcher delim) {
|
||||
public StrTokenizer(final char[] input, final StrMatcher delim) {
|
||||
this(input);
|
||||
setDelimiterMatcher(delim);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param delim the field delimiter character
|
||||
* @param quote the field quoted string character
|
||||
*/
|
||||
public StrTokenizer(char[] input, char delim, char quote) {
|
||||
public StrTokenizer(final char[] input, final char delim, final char quote) {
|
||||
this(input, delim);
|
||||
setQuoteChar(quote);
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param delim the field delimiter character
|
||||
* @param quote the field quoted string character
|
||||
*/
|
||||
public StrTokenizer(char[] input, StrMatcher delim, StrMatcher quote) {
|
||||
public StrTokenizer(final char[] input, final StrMatcher delim, final StrMatcher quote) {
|
||||
this(input, delim);
|
||||
setQuoteMatcher(quote);
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the new string to tokenize, null sets no text to parse
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer reset(String input) {
|
||||
public StrTokenizer reset(final String input) {
|
||||
reset();
|
||||
if (input != null) {
|
||||
this.chars = input.toCharArray();
|
||||
|
@ -487,7 +487,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param input the new character array to tokenize, not cloned, null sets no text to parse
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer reset(char[] input) {
|
||||
public StrTokenizer reset(final char[] input) {
|
||||
reset();
|
||||
this.chars = ArrayUtils.clone(input);
|
||||
return this;
|
||||
|
@ -580,7 +580,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @throws UnsupportedOperationException always
|
||||
*/
|
||||
@Override
|
||||
public void set(String obj) {
|
||||
public void set(final String obj) {
|
||||
throw new UnsupportedOperationException("set() is unsupported");
|
||||
}
|
||||
|
||||
|
@ -590,7 +590,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @throws UnsupportedOperationException always
|
||||
*/
|
||||
@Override
|
||||
public void add(String obj) {
|
||||
public void add(final String obj) {
|
||||
throw new UnsupportedOperationException("add() is unsupported");
|
||||
}
|
||||
|
||||
|
@ -632,7 +632,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param count the number of characters to tokenize, must be valid
|
||||
* @return the modifiable list of String tokens, unmodifiable if null array or zero count
|
||||
*/
|
||||
protected List<String> tokenize(char[] chars, int offset, int count) {
|
||||
protected List<String> tokenize(final char[] chars, final int offset, final int count) {
|
||||
if (chars == null || count == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param list the list to add to
|
||||
* @param tok the token to add
|
||||
*/
|
||||
private void addToken(List<String> list, String tok) {
|
||||
private void addToken(final List<String> list, String tok) {
|
||||
if (StringUtils.isEmpty(tok)) {
|
||||
if (isIgnoreEmptyTokens()) {
|
||||
return;
|
||||
|
@ -682,7 +682,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @return the starting position of the next field (the character
|
||||
* immediately after the delimiter), or -1 if end of string found
|
||||
*/
|
||||
private int readNextToken(char[] chars, int start, int len, StrBuilder workArea, List<String> tokens) {
|
||||
private int readNextToken(final char[] chars, int start, final int len, final StrBuilder workArea, final List<String> tokens) {
|
||||
// skip all leading whitespace, unless it is the
|
||||
// field delimiter or the quote character
|
||||
while (start < len) {
|
||||
|
@ -732,8 +732,8 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* immediately after the delimiter, or if end of string found,
|
||||
* then the length of string
|
||||
*/
|
||||
private int readWithQuotes(char[] chars, int start, int len, StrBuilder workArea,
|
||||
List<String> tokens, int quoteStart, int quoteLen) {
|
||||
private int readWithQuotes(final char[] chars, final int start, final int len, final StrBuilder workArea,
|
||||
final List<String> tokens, final int quoteStart, final int quoteLen) {
|
||||
// Loop until we've found the end of the quoted
|
||||
// string or the end of the input
|
||||
workArea.clear();
|
||||
|
@ -828,7 +828,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param quoteLen the length of the matched quote, 0 if no quoting
|
||||
* @return true if a quote is matched
|
||||
*/
|
||||
private boolean isQuote(char[] chars, int pos, int len, int quoteStart, int quoteLen) {
|
||||
private boolean isQuote(final char[] chars, final int pos, final int len, final int quoteStart, final int quoteLen) {
|
||||
for (int i = 0; i < quoteLen; i++) {
|
||||
if (pos + i >= len || chars[pos + i] != chars[quoteStart + i]) {
|
||||
return false;
|
||||
|
@ -856,7 +856,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param delim the delimiter matcher to use
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer setDelimiterMatcher(StrMatcher delim) {
|
||||
public StrTokenizer setDelimiterMatcher(final StrMatcher delim) {
|
||||
if (delim == null) {
|
||||
this.delimMatcher = StrMatcher.noneMatcher();
|
||||
} else {
|
||||
|
@ -871,7 +871,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param delim the delimiter character to use
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer setDelimiterChar(char delim) {
|
||||
public StrTokenizer setDelimiterChar(final char delim) {
|
||||
return setDelimiterMatcher(StrMatcher.charMatcher(delim));
|
||||
}
|
||||
|
||||
|
@ -881,7 +881,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param delim the delimiter string to use
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer setDelimiterString(String delim) {
|
||||
public StrTokenizer setDelimiterString(final String delim) {
|
||||
return setDelimiterMatcher(StrMatcher.stringMatcher(delim));
|
||||
}
|
||||
|
||||
|
@ -909,7 +909,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param quote the quote matcher to use, null ignored
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer setQuoteMatcher(StrMatcher quote) {
|
||||
public StrTokenizer setQuoteMatcher(final StrMatcher quote) {
|
||||
if (quote != null) {
|
||||
this.quoteMatcher = quote;
|
||||
}
|
||||
|
@ -925,7 +925,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param quote the quote character to use
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer setQuoteChar(char quote) {
|
||||
public StrTokenizer setQuoteChar(final char quote) {
|
||||
return setQuoteMatcher(StrMatcher.charMatcher(quote));
|
||||
}
|
||||
|
||||
|
@ -953,7 +953,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param ignored the ignored matcher to use, null ignored
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer setIgnoredMatcher(StrMatcher ignored) {
|
||||
public StrTokenizer setIgnoredMatcher(final StrMatcher ignored) {
|
||||
if (ignored != null) {
|
||||
this.ignoredMatcher = ignored;
|
||||
}
|
||||
|
@ -969,7 +969,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param ignored the ignored character to use
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer setIgnoredChar(char ignored) {
|
||||
public StrTokenizer setIgnoredChar(final char ignored) {
|
||||
return setIgnoredMatcher(StrMatcher.charMatcher(ignored));
|
||||
}
|
||||
|
||||
|
@ -997,7 +997,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param trimmer the trimmer matcher to use, null ignored
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer setTrimmerMatcher(StrMatcher trimmer) {
|
||||
public StrTokenizer setTrimmerMatcher(final StrMatcher trimmer) {
|
||||
if (trimmer != null) {
|
||||
this.trimmerMatcher = trimmer;
|
||||
}
|
||||
|
@ -1022,7 +1022,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param emptyAsNull whether empty tokens are returned as null
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer setEmptyTokenAsNull(boolean emptyAsNull) {
|
||||
public StrTokenizer setEmptyTokenAsNull(final boolean emptyAsNull) {
|
||||
this.emptyAsNull = emptyAsNull;
|
||||
return this;
|
||||
}
|
||||
|
@ -1045,7 +1045,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* @param ignoreEmptyTokens whether empty tokens are not returned
|
||||
* @return this, to enable chaining
|
||||
*/
|
||||
public StrTokenizer setIgnoreEmptyTokens(boolean ignoreEmptyTokens) {
|
||||
public StrTokenizer setIgnoreEmptyTokens(final boolean ignoreEmptyTokens) {
|
||||
this.ignoreEmptyTokens = ignoreEmptyTokens;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class WordUtils {
|
|||
* @param wrapLength the column to wrap the words at, less than 1 is treated as 1
|
||||
* @return a line with newlines inserted, <code>null</code> if null input
|
||||
*/
|
||||
public static String wrap(String str, int wrapLength) {
|
||||
public static String wrap(final String str, final int wrapLength) {
|
||||
return wrap(str, wrapLength, null, false);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class WordUtils {
|
|||
* @param wrapLongWords true if long words (such as URLs) should be wrapped
|
||||
* @return a line with newlines inserted, <code>null</code> if null input
|
||||
*/
|
||||
public static String wrap(String str, int wrapLength, String newLineStr, boolean wrapLongWords) {
|
||||
public static String wrap(final String str, int wrapLength, String newLineStr, final boolean wrapLongWords) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ public class WordUtils {
|
|||
* @see #uncapitalize(String)
|
||||
* @see #capitalizeFully(String)
|
||||
*/
|
||||
public static String capitalize(String str) {
|
||||
public static String capitalize(final String str) {
|
||||
return capitalize(str, null);
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class WordUtils {
|
|||
* @see #capitalizeFully(String)
|
||||
* @since 2.1
|
||||
*/
|
||||
public static String capitalize(String str, char... delimiters) {
|
||||
public static String capitalize(final String str, final char... delimiters) {
|
||||
int delimLen = delimiters == null ? -1 : delimiters.length;
|
||||
if (StringUtils.isEmpty(str) || delimLen == 0) {
|
||||
return str;
|
||||
|
@ -236,7 +236,7 @@ public class WordUtils {
|
|||
* @param str the String to capitalize, may be null
|
||||
* @return capitalized String, <code>null</code> if null String input
|
||||
*/
|
||||
public static String capitalizeFully(String str) {
|
||||
public static String capitalizeFully(final String str) {
|
||||
return capitalizeFully(str, null);
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ public class WordUtils {
|
|||
* @return capitalized String, <code>null</code> if null String input
|
||||
* @since 2.1
|
||||
*/
|
||||
public static String capitalizeFully(String str, char... delimiters) {
|
||||
public static String capitalizeFully(String str, final char... delimiters) {
|
||||
int delimLen = delimiters == null ? -1 : delimiters.length;
|
||||
if (StringUtils.isEmpty(str) || delimLen == 0) {
|
||||
return str;
|
||||
|
@ -293,7 +293,7 @@ public class WordUtils {
|
|||
* @return uncapitalized String, <code>null</code> if null String input
|
||||
* @see #capitalize(String)
|
||||
*/
|
||||
public static String uncapitalize(String str) {
|
||||
public static String uncapitalize(final String str) {
|
||||
return uncapitalize(str, null);
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ public class WordUtils {
|
|||
* @see #capitalize(String)
|
||||
* @since 2.1
|
||||
*/
|
||||
public static String uncapitalize(String str, char... delimiters) {
|
||||
public static String uncapitalize(final String str, final char... delimiters) {
|
||||
int delimLen = delimiters == null ? -1 : delimiters.length;
|
||||
if (StringUtils.isEmpty(str) || delimLen == 0) {
|
||||
return str;
|
||||
|
@ -364,7 +364,7 @@ public class WordUtils {
|
|||
* @param str the String to swap case, may be null
|
||||
* @return the changed String, <code>null</code> if null String input
|
||||
*/
|
||||
public static String swapCase(String str) {
|
||||
public static String swapCase(final String str) {
|
||||
if (StringUtils.isEmpty(str)) {
|
||||
return str;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ public class WordUtils {
|
|||
* @see #initials(String,char[])
|
||||
* @since 2.2
|
||||
*/
|
||||
public static String initials(String str) {
|
||||
public static String initials(final String str) {
|
||||
return initials(str, null);
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,7 @@ public class WordUtils {
|
|||
* @see #initials(String)
|
||||
* @since 2.2
|
||||
*/
|
||||
public static String initials(String str, char... delimiters) {
|
||||
public static String initials(final String str, final char... delimiters) {
|
||||
if (StringUtils.isEmpty(str)) {
|
||||
return str;
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ public class WordUtils {
|
|||
* @param delimiters the delimiters
|
||||
* @return true if it is a delimiter
|
||||
*/
|
||||
private static boolean isDelimiter(char ch, char[] delimiters) {
|
||||
private static boolean isDelimiter(final char ch, final char[] delimiters) {
|
||||
if (delimiters == null) {
|
||||
return Character.isWhitespace(ch);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class AggregateTranslator extends CharSequenceTranslator {
|
|||
*
|
||||
* @param translators CharSequenceTranslator array to aggregate
|
||||
*/
|
||||
public AggregateTranslator(CharSequenceTranslator... translators) {
|
||||
public AggregateTranslator(final CharSequenceTranslator... translators) {
|
||||
this.translators = ArrayUtils.clone(translators);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class AggregateTranslator extends CharSequenceTranslator {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int translate(CharSequence input, int index, Writer out) throws IOException {
|
||||
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
|
||||
for (CharSequenceTranslator translator : translators) {
|
||||
int consumed = translator.translate(input, index, out);
|
||||
if(consumed != 0) {
|
||||
|
|
|
@ -50,7 +50,7 @@ public abstract class CharSequenceTranslator {
|
|||
* @param input CharSequence to be translated
|
||||
* @return String output of translation
|
||||
*/
|
||||
public final String translate(CharSequence input) {
|
||||
public final String translate(final CharSequence input) {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public abstract class CharSequenceTranslator {
|
|||
* @param out Writer to translate the text to
|
||||
* @throws IOException if and only if the Writer produces an IOException
|
||||
*/
|
||||
public final void translate(CharSequence input, Writer out) throws IOException {
|
||||
public final void translate(final CharSequence input, final Writer out) throws IOException {
|
||||
if (out == null) {
|
||||
throw new IllegalArgumentException("The Writer must not be null");
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public abstract class CharSequenceTranslator {
|
|||
* @param translators CharSequenceTranslator array of translators to merge with this one
|
||||
* @return CharSequenceTranslator merging this translator with the others
|
||||
*/
|
||||
public final CharSequenceTranslator with(CharSequenceTranslator... translators) {
|
||||
public final CharSequenceTranslator with(final CharSequenceTranslator... translators) {
|
||||
CharSequenceTranslator[] newArray = new CharSequenceTranslator[translators.length + 1];
|
||||
newArray[0] = this;
|
||||
System.arraycopy(translators, 0, newArray, 1, translators.length);
|
||||
|
@ -118,7 +118,7 @@ public abstract class CharSequenceTranslator {
|
|||
* @param codepoint The codepoint to convert.
|
||||
* @return An upper case hexadecimal <code>String</code>
|
||||
*/
|
||||
public static String hex(int codepoint) {
|
||||
public static String hex(final int codepoint) {
|
||||
return Integer.toHexString(codepoint).toUpperCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public abstract class CodePointTranslator extends CharSequenceTranslator {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final int translate(CharSequence input, int index, Writer out) throws IOException {
|
||||
public final int translate(final CharSequence input, final int index, final Writer out) throws IOException {
|
||||
int codepoint = Character.codePointAt(input, index);
|
||||
boolean consumed = translate(codepoint, out);
|
||||
if (consumed) {
|
||||
|
|
|
@ -413,7 +413,7 @@ public class EntityArrays {
|
|||
* @param array String[][] to be inverted
|
||||
* @return String[][] inverted array
|
||||
*/
|
||||
public static String[][] invert(String[][] array) {
|
||||
public static String[][] invert(final String[][] array) {
|
||||
String[][] newarray = new String[array.length][2];
|
||||
for(int i = 0; i<array.length; i++) {
|
||||
newarray[i][0] = array[i][1];
|
||||
|
|
|
@ -17,7 +17,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
|
|||
* above which to escape
|
||||
* @return the newly created {@code UnicodeEscaper} instance
|
||||
*/
|
||||
public static JavaUnicodeEscaper above(int codepoint) {
|
||||
public static JavaUnicodeEscaper above(final int codepoint) {
|
||||
return outsideOf(0, codepoint);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
|
|||
* below which to escape
|
||||
* @return the newly created {@code UnicodeEscaper} instance
|
||||
*/
|
||||
public static JavaUnicodeEscaper below(int codepoint) {
|
||||
public static JavaUnicodeEscaper below(final int codepoint) {
|
||||
return outsideOf(codepoint, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
|
|||
* below which to escape
|
||||
* @return the newly created {@code UnicodeEscaper} instance
|
||||
*/
|
||||
public static JavaUnicodeEscaper between(int codepointLow, int codepointHigh) {
|
||||
public static JavaUnicodeEscaper between(final int codepointLow, final int codepointHigh) {
|
||||
return new JavaUnicodeEscaper(codepointLow, codepointHigh, true);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
|
|||
* above which to escape
|
||||
* @return the newly created {@code UnicodeEscaper} instance
|
||||
*/
|
||||
public static JavaUnicodeEscaper outsideOf(int codepointLow, int codepointHigh) {
|
||||
public static JavaUnicodeEscaper outsideOf(final int codepointLow, final int codepointHigh) {
|
||||
return new JavaUnicodeEscaper(codepointLow, codepointHigh, false);
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
|
|||
* @param between
|
||||
* whether to escape between the boundaries or outside them
|
||||
*/
|
||||
public JavaUnicodeEscaper(int below, int above, boolean between) {
|
||||
public JavaUnicodeEscaper(final int below, final int above, final boolean between) {
|
||||
super(below, above, between);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
|
|||
* a Unicode code point
|
||||
*/
|
||||
@Override
|
||||
protected String toUtf16Escape(int codepoint) {
|
||||
protected String toUtf16Escape(final int codepoint) {
|
||||
char[] surrogatePair = Character.toChars(codepoint);
|
||||
return "\\u" + hex(surrogatePair[0]) + "\\u" + hex(surrogatePair[1]);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class LookupTranslator extends CharSequenceTranslator {
|
|||
*
|
||||
* @param lookup CharSequence[][] table of size [*][2]
|
||||
*/
|
||||
public LookupTranslator(CharSequence[]... lookup) {
|
||||
public LookupTranslator(final CharSequence[]... lookup) {
|
||||
lookupMap = new HashMap<CharSequence, CharSequence>();
|
||||
int _shortest = Integer.MAX_VALUE;
|
||||
int _longest = 0;
|
||||
|
@ -61,7 +61,7 @@ public class LookupTranslator extends CharSequenceTranslator {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int translate(CharSequence input, int index, Writer out) throws IOException {
|
||||
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
|
||||
int max = longest;
|
||||
if (index + longest > input.length()) {
|
||||
max = input.length() - index;
|
||||
|
|
|
@ -41,7 +41,7 @@ public class NumericEntityEscaper extends CodePointTranslator {
|
|||
* @param above int value representing the highest codepoint boundary
|
||||
* @param between whether to escape between the boundaries or outside them
|
||||
*/
|
||||
private NumericEntityEscaper(int below, int above, boolean between) {
|
||||
private NumericEntityEscaper(final int below, final int above, final boolean between) {
|
||||
this.below = below;
|
||||
this.above = above;
|
||||
this.between = between;
|
||||
|
@ -60,7 +60,7 @@ public class NumericEntityEscaper extends CodePointTranslator {
|
|||
* @param codepoint below which to escape
|
||||
* @return the newly created {@code NumericEntityEscaper} instance
|
||||
*/
|
||||
public static NumericEntityEscaper below(int codepoint) {
|
||||
public static NumericEntityEscaper below(final int codepoint) {
|
||||
return outsideOf(codepoint, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class NumericEntityEscaper extends CodePointTranslator {
|
|||
* @param codepoint above which to escape
|
||||
* @return the newly created {@code NumericEntityEscaper} instance
|
||||
*/
|
||||
public static NumericEntityEscaper above(int codepoint) {
|
||||
public static NumericEntityEscaper above(final int codepoint) {
|
||||
return outsideOf(0, codepoint);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class NumericEntityEscaper extends CodePointTranslator {
|
|||
* @param codepointHigh below which to escape
|
||||
* @return the newly created {@code NumericEntityEscaper} instance
|
||||
*/
|
||||
public static NumericEntityEscaper between(int codepointLow, int codepointHigh) {
|
||||
public static NumericEntityEscaper between(final int codepointLow, final int codepointHigh) {
|
||||
return new NumericEntityEscaper(codepointLow, codepointHigh, true);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class NumericEntityEscaper extends CodePointTranslator {
|
|||
* @param codepointHigh above which to escape
|
||||
* @return the newly created {@code NumericEntityEscaper} instance
|
||||
*/
|
||||
public static NumericEntityEscaper outsideOf(int codepointLow, int codepointHigh) {
|
||||
public static NumericEntityEscaper outsideOf(final int codepointLow, final int codepointHigh) {
|
||||
return new NumericEntityEscaper(codepointLow, codepointHigh, false);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class NumericEntityEscaper extends CodePointTranslator {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean translate(int codepoint, Writer out) throws IOException {
|
||||
public boolean translate(final int codepoint, final Writer out) throws IOException {
|
||||
if(between) {
|
||||
if (codepoint < below || codepoint > above) {
|
||||
return false;
|
||||
|
|
|
@ -53,7 +53,7 @@ public class NumericEntityUnescaper extends CharSequenceTranslator {
|
|||
*
|
||||
* @param options to apply to this unescaper
|
||||
*/
|
||||
public NumericEntityUnescaper(OPTION... options) {
|
||||
public NumericEntityUnescaper(final OPTION... options) {
|
||||
if(options.length > 0) {
|
||||
this.options = EnumSet.copyOf(Arrays.asList(options));
|
||||
} else {
|
||||
|
@ -67,7 +67,7 @@ public class NumericEntityUnescaper extends CharSequenceTranslator {
|
|||
* @param option to check state of
|
||||
* @return whether the option is set
|
||||
*/
|
||||
public boolean isSet(OPTION option) {
|
||||
public boolean isSet(final OPTION option) {
|
||||
return options == null ? false : options.contains(option);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class NumericEntityUnescaper extends CharSequenceTranslator {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int translate(CharSequence input, int index, Writer out) throws IOException {
|
||||
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
|
||||
int seqEnd = input.length();
|
||||
// Uses -2 to ensure there is something after the &#
|
||||
if(input.charAt(index) == '&' && index < seqEnd - 2 && input.charAt(index + 1) == '#') {
|
||||
|
|
|
@ -39,7 +39,7 @@ public class OctalUnescaper extends CharSequenceTranslator {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int translate(CharSequence input, int index, Writer out) throws IOException {
|
||||
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
|
||||
if(input.charAt(index) == '\\' && index < (input.length() - 1) && Character.isDigit(input.charAt(index + 1)) ) {
|
||||
int start = index + 1;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class UnicodeEscaper extends CodePointTranslator {
|
|||
* @param above int value representing the highest codepoint boundary
|
||||
* @param between whether to escape between the boundaries or outside them
|
||||
*/
|
||||
protected UnicodeEscaper(int below, int above, boolean between) {
|
||||
protected UnicodeEscaper(final int below, final int above, final boolean between) {
|
||||
this.below = below;
|
||||
this.above = above;
|
||||
this.between = between;
|
||||
|
@ -60,7 +60,7 @@ public class UnicodeEscaper extends CodePointTranslator {
|
|||
* @param codepoint below which to escape
|
||||
* @return the newly created {@code UnicodeEscaper} instance
|
||||
*/
|
||||
public static UnicodeEscaper below(int codepoint) {
|
||||
public static UnicodeEscaper below(final int codepoint) {
|
||||
return outsideOf(codepoint, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class UnicodeEscaper extends CodePointTranslator {
|
|||
* @param codepoint above which to escape
|
||||
* @return the newly created {@code UnicodeEscaper} instance
|
||||
*/
|
||||
public static UnicodeEscaper above(int codepoint) {
|
||||
public static UnicodeEscaper above(final int codepoint) {
|
||||
return outsideOf(0, codepoint);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class UnicodeEscaper extends CodePointTranslator {
|
|||
* @param codepointHigh above which to escape
|
||||
* @return the newly created {@code UnicodeEscaper} instance
|
||||
*/
|
||||
public static UnicodeEscaper outsideOf(int codepointLow, int codepointHigh) {
|
||||
public static UnicodeEscaper outsideOf(final int codepointLow, final int codepointHigh) {
|
||||
return new UnicodeEscaper(codepointLow, codepointHigh, false);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class UnicodeEscaper extends CodePointTranslator {
|
|||
* @param codepointHigh below which to escape
|
||||
* @return the newly created {@code UnicodeEscaper} instance
|
||||
*/
|
||||
public static UnicodeEscaper between(int codepointLow, int codepointHigh) {
|
||||
public static UnicodeEscaper between(final int codepointLow, final int codepointHigh) {
|
||||
return new UnicodeEscaper(codepointLow, codepointHigh, true);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class UnicodeEscaper extends CodePointTranslator {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean translate(int codepoint, Writer out) throws IOException {
|
||||
public boolean translate(final int codepoint, final Writer out) throws IOException {
|
||||
if (between) {
|
||||
if (codepoint < below || codepoint > above) {
|
||||
return false;
|
||||
|
@ -126,7 +126,7 @@ public class UnicodeEscaper extends CodePointTranslator {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected String toUtf16Escape(int codepoint) {
|
||||
protected String toUtf16Escape(final int codepoint) {
|
||||
return "\\u" + hex(codepoint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class UnicodeUnescaper extends CharSequenceTranslator {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int translate(CharSequence input, int index, Writer out) throws IOException {
|
||||
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
|
||||
if (input.charAt(index) == '\\' && index + 1 < input.length() && input.charAt(index + 1) == 'u') {
|
||||
// consume optional additional 'u' chars
|
||||
int i = 2;
|
||||
|
|
|
@ -127,7 +127,7 @@ public class DateFormatUtils {
|
|||
* @param pattern the pattern to use to format the date, not null
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String formatUTC(long millis, String pattern) {
|
||||
public static String formatUTC(final long millis, final String pattern) {
|
||||
return format(new Date(millis), pattern, UTC_TIME_ZONE, null);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class DateFormatUtils {
|
|||
* @param pattern the pattern to use to format the date, not null
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String formatUTC(Date date, String pattern) {
|
||||
public static String formatUTC(final Date date, final String pattern) {
|
||||
return format(date, pattern, UTC_TIME_ZONE, null);
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ public class DateFormatUtils {
|
|||
* @param locale the locale to use, may be <code>null</code>
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String formatUTC(long millis, String pattern, Locale locale) {
|
||||
public static String formatUTC(final long millis, final String pattern, final Locale locale) {
|
||||
return format(new Date(millis), pattern, UTC_TIME_ZONE, locale);
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ public class DateFormatUtils {
|
|||
* @param locale the locale to use, may be <code>null</code>
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String formatUTC(Date date, String pattern, Locale locale) {
|
||||
public static String formatUTC(final Date date, final String pattern, final Locale locale) {
|
||||
return format(date, pattern, UTC_TIME_ZONE, locale);
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public class DateFormatUtils {
|
|||
* @param pattern the pattern to use to format the date, not null
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String format(long millis, String pattern) {
|
||||
public static String format(final long millis, final String pattern) {
|
||||
return format(new Date(millis), pattern, null, null);
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ public class DateFormatUtils {
|
|||
* @param pattern the pattern to use to format the date, not null
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String format(Date date, String pattern) {
|
||||
public static String format(final Date date, final String pattern) {
|
||||
return format(date, pattern, null, null);
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class DateFormatUtils {
|
|||
* @see FastDateFormat#format(Calendar)
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String format(Calendar calendar, String pattern) {
|
||||
public static String format(final Calendar calendar, final String pattern) {
|
||||
return format(calendar, pattern, null, null);
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ public class DateFormatUtils {
|
|||
* @param timeZone the time zone to use, may be <code>null</code>
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String format(long millis, String pattern, TimeZone timeZone) {
|
||||
public static String format(final long millis, final String pattern, final TimeZone timeZone) {
|
||||
return format(new Date(millis), pattern, timeZone, null);
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ public class DateFormatUtils {
|
|||
* @param timeZone the time zone to use, may be <code>null</code>
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String format(Date date, String pattern, TimeZone timeZone) {
|
||||
public static String format(final Date date, final String pattern, final TimeZone timeZone) {
|
||||
return format(date, pattern, timeZone, null);
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ public class DateFormatUtils {
|
|||
* @see FastDateFormat#format(Calendar)
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String format(Calendar calendar, String pattern, TimeZone timeZone) {
|
||||
public static String format(final Calendar calendar, final String pattern, final TimeZone timeZone) {
|
||||
return format(calendar, pattern, timeZone, null);
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ public class DateFormatUtils {
|
|||
* @param locale the locale to use, may be <code>null</code>
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String format(long millis, String pattern, Locale locale) {
|
||||
public static String format(final long millis, final String pattern, final Locale locale) {
|
||||
return format(new Date(millis), pattern, null, locale);
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ public class DateFormatUtils {
|
|||
* @param locale the locale to use, may be <code>null</code>
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String format(Date date, String pattern, Locale locale) {
|
||||
public static String format(final Date date, final String pattern, final Locale locale) {
|
||||
return format(date, pattern, null, locale);
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ public class DateFormatUtils {
|
|||
* @see FastDateFormat#format(Calendar)
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String format(Calendar calendar, String pattern, Locale locale) {
|
||||
public static String format(final Calendar calendar, final String pattern, final Locale locale) {
|
||||
return format(calendar, pattern, null, locale);
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ public class DateFormatUtils {
|
|||
* @param locale the locale to use, may be <code>null</code>
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String format(long millis, String pattern, TimeZone timeZone, Locale locale) {
|
||||
public static String format(final long millis, final String pattern, final TimeZone timeZone, final Locale locale) {
|
||||
return format(new Date(millis), pattern, timeZone, locale);
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ public class DateFormatUtils {
|
|||
* @param locale the locale to use, may be <code>null</code>
|
||||
* @return the formatted date
|
||||
*/
|
||||
public static String format(Date date, String pattern, TimeZone timeZone, Locale locale) {
|
||||
public static String format(final Date date, final String pattern, final TimeZone timeZone, final Locale locale) {
|
||||
FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale);
|
||||
return df.format(date);
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ public class DateFormatUtils {
|
|||
* @see FastDateFormat#format(Calendar)
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String format(Calendar calendar, String pattern, TimeZone timeZone, Locale locale) {
|
||||
public static String format(final Calendar calendar, final String pattern, final TimeZone timeZone, final Locale locale) {
|
||||
FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale);
|
||||
return df.format(calendar);
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if either date is <code>null</code>
|
||||
* @since 2.1
|
||||
*/
|
||||
public static boolean isSameDay(Date date1, Date date2) {
|
||||
public static boolean isSameDay(final Date date1, final Date date2) {
|
||||
if (date1 == null || date2 == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if either calendar is <code>null</code>
|
||||
* @since 2.1
|
||||
*/
|
||||
public static boolean isSameDay(Calendar cal1, Calendar cal2) {
|
||||
public static boolean isSameDay(final Calendar cal1, final Calendar cal2) {
|
||||
if (cal1 == null || cal2 == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if either date is <code>null</code>
|
||||
* @since 2.1
|
||||
*/
|
||||
public static boolean isSameInstant(Date date1, Date date2) {
|
||||
public static boolean isSameInstant(final Date date1, final Date date2) {
|
||||
if (date1 == null || date2 == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if either date is <code>null</code>
|
||||
* @since 2.1
|
||||
*/
|
||||
public static boolean isSameInstant(Calendar cal1, Calendar cal2) {
|
||||
public static boolean isSameInstant(final Calendar cal1, final Calendar cal2) {
|
||||
if (cal1 == null || cal2 == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if either date is <code>null</code>
|
||||
* @since 2.1
|
||||
*/
|
||||
public static boolean isSameLocalTime(Calendar cal1, Calendar cal2) {
|
||||
public static boolean isSameLocalTime(final Calendar cal1, final Calendar cal2) {
|
||||
if (cal1 == null || cal2 == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date string or pattern array is null
|
||||
* @throws ParseException if none of the date patterns were suitable (or there were none)
|
||||
*/
|
||||
public static Date parseDate(String str, String... parsePatterns) throws ParseException {
|
||||
public static Date parseDate(final String str, final String... parsePatterns) throws ParseException {
|
||||
return parseDate(str, null, parsePatterns);
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ public class DateUtils {
|
|||
* @throws ParseException if none of the date patterns were suitable (or there were none)
|
||||
* @since 3.2
|
||||
*/
|
||||
public static Date parseDate(String str, Locale locale, String... parsePatterns) throws ParseException {
|
||||
public static Date parseDate(final String str, final Locale locale, final String... parsePatterns) throws ParseException {
|
||||
return parseDateWithLeniency(str, locale, parsePatterns, true);
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ public class DateUtils {
|
|||
* @throws ParseException if none of the date patterns were suitable
|
||||
* @since 2.5
|
||||
*/
|
||||
public static Date parseDateStrictly(String str, String... parsePatterns) throws ParseException {
|
||||
public static Date parseDateStrictly(final String str, final String... parsePatterns) throws ParseException {
|
||||
return parseDateStrictly(str, null, parsePatterns);
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ public class DateUtils {
|
|||
* @throws ParseException if none of the date patterns were suitable
|
||||
* @since 3.2
|
||||
*/
|
||||
public static Date parseDateStrictly(String str, Locale locale, String... parsePatterns) throws ParseException {
|
||||
public static Date parseDateStrictly(final String str, final Locale locale, final String... parsePatterns) throws ParseException {
|
||||
return parseDateWithLeniency(str, null, parsePatterns, false);
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ public class DateUtils {
|
|||
* @see java.util.Calender#isLenient()
|
||||
*/
|
||||
private static Date parseDateWithLeniency(
|
||||
String str, Locale locale, String[] parsePatterns, boolean lenient) throws ParseException {
|
||||
final String str, final Locale locale, final String[] parsePatterns, final boolean lenient) throws ParseException {
|
||||
if (str == null || parsePatterns == null) {
|
||||
throw new IllegalArgumentException("Date and Patterns must not be null");
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ public class DateUtils {
|
|||
* @return the new {@code Date} with the amount added
|
||||
* @throws IllegalArgumentException if the date is null
|
||||
*/
|
||||
public static Date addYears(Date date, int amount) {
|
||||
public static Date addYears(final Date date, final int amount) {
|
||||
return add(date, Calendar.YEAR, amount);
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,7 @@ public class DateUtils {
|
|||
* @return the new {@code Date} with the amount added
|
||||
* @throws IllegalArgumentException if the date is null
|
||||
*/
|
||||
public static Date addMonths(Date date, int amount) {
|
||||
public static Date addMonths(final Date date, final int amount) {
|
||||
return add(date, Calendar.MONTH, amount);
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ public class DateUtils {
|
|||
* @return the new {@code Date} with the amount added
|
||||
* @throws IllegalArgumentException if the date is null
|
||||
*/
|
||||
public static Date addWeeks(Date date, int amount) {
|
||||
public static Date addWeeks(final Date date, final int amount) {
|
||||
return add(date, Calendar.WEEK_OF_YEAR, amount);
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ public class DateUtils {
|
|||
* @return the new {@code Date} with the amount added
|
||||
* @throws IllegalArgumentException if the date is null
|
||||
*/
|
||||
public static Date addDays(Date date, int amount) {
|
||||
public static Date addDays(final Date date, final int amount) {
|
||||
return add(date, Calendar.DAY_OF_MONTH, amount);
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ public class DateUtils {
|
|||
* @return the new {@code Date} with the amount added
|
||||
* @throws IllegalArgumentException if the date is null
|
||||
*/
|
||||
public static Date addHours(Date date, int amount) {
|
||||
public static Date addHours(final Date date, final int amount) {
|
||||
return add(date, Calendar.HOUR_OF_DAY, amount);
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,7 @@ public class DateUtils {
|
|||
* @return the new {@code Date} with the amount added
|
||||
* @throws IllegalArgumentException if the date is null
|
||||
*/
|
||||
public static Date addMinutes(Date date, int amount) {
|
||||
public static Date addMinutes(final Date date, final int amount) {
|
||||
return add(date, Calendar.MINUTE, amount);
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,7 @@ public class DateUtils {
|
|||
* @return the new {@code Date} with the amount added
|
||||
* @throws IllegalArgumentException if the date is null
|
||||
*/
|
||||
public static Date addSeconds(Date date, int amount) {
|
||||
public static Date addSeconds(final Date date, final int amount) {
|
||||
return add(date, Calendar.SECOND, amount);
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,7 @@ public class DateUtils {
|
|||
* @return the new {@code Date} with the amount added
|
||||
* @throws IllegalArgumentException if the date is null
|
||||
*/
|
||||
public static Date addMilliseconds(Date date, int amount) {
|
||||
public static Date addMilliseconds(final Date date, final int amount) {
|
||||
return add(date, Calendar.MILLISECOND, amount);
|
||||
}
|
||||
|
||||
|
@ -513,7 +513,7 @@ public class DateUtils {
|
|||
* @return the new {@code Date} with the amount added
|
||||
* @throws IllegalArgumentException if the date is null
|
||||
*/
|
||||
private static Date add(Date date, int calendarField, int amount) {
|
||||
private static Date add(final Date date, final int calendarField, final int amount) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is null
|
||||
* @since 2.4
|
||||
*/
|
||||
public static Date setYears(Date date, int amount) {
|
||||
public static Date setYears(final Date date, final int amount) {
|
||||
return set(date, Calendar.YEAR, amount);
|
||||
}
|
||||
|
||||
|
@ -549,7 +549,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is null
|
||||
* @since 2.4
|
||||
*/
|
||||
public static Date setMonths(Date date, int amount) {
|
||||
public static Date setMonths(final Date date, final int amount) {
|
||||
return set(date, Calendar.MONTH, amount);
|
||||
}
|
||||
|
||||
|
@ -564,7 +564,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is null
|
||||
* @since 2.4
|
||||
*/
|
||||
public static Date setDays(Date date, int amount) {
|
||||
public static Date setDays(final Date date, final int amount) {
|
||||
return set(date, Calendar.DAY_OF_MONTH, amount);
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is null
|
||||
* @since 2.4
|
||||
*/
|
||||
public static Date setHours(Date date, int amount) {
|
||||
public static Date setHours(final Date date, final int amount) {
|
||||
return set(date, Calendar.HOUR_OF_DAY, amount);
|
||||
}
|
||||
|
||||
|
@ -595,7 +595,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is null
|
||||
* @since 2.4
|
||||
*/
|
||||
public static Date setMinutes(Date date, int amount) {
|
||||
public static Date setMinutes(final Date date, final int amount) {
|
||||
return set(date, Calendar.MINUTE, amount);
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is null
|
||||
* @since 2.4
|
||||
*/
|
||||
public static Date setSeconds(Date date, int amount) {
|
||||
public static Date setSeconds(final Date date, final int amount) {
|
||||
return set(date, Calendar.SECOND, amount);
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is null
|
||||
* @since 2.4
|
||||
*/
|
||||
public static Date setMilliseconds(Date date, int amount) {
|
||||
public static Date setMilliseconds(final Date date, final int amount) {
|
||||
return set(date, Calendar.MILLISECOND, amount);
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is null
|
||||
* @since 2.4
|
||||
*/
|
||||
private static Date set(Date date, int calendarField, int amount) {
|
||||
private static Date set(final Date date, final int calendarField, final int amount) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -663,7 +663,7 @@ public class DateUtils {
|
|||
* @throws NullPointerException if null is passed in
|
||||
* @since 3.0
|
||||
*/
|
||||
public static Calendar toCalendar(Date date) {
|
||||
public static Calendar toCalendar(final Date date) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(date);
|
||||
return c;
|
||||
|
@ -696,7 +696,7 @@ public class DateUtils {
|
|||
* @return the different rounded date, not null
|
||||
* @throws ArithmeticException if the year is over 280 million
|
||||
*/
|
||||
public static Date round(Date date, int field) {
|
||||
public static Date round(final Date date, final int field) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is <code>null</code>
|
||||
* @throws ArithmeticException if the year is over 280 million
|
||||
*/
|
||||
public static Calendar round(Calendar date, int field) {
|
||||
public static Calendar round(final Calendar date, final int field) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ public class DateUtils {
|
|||
* @throws ClassCastException if the object type is not a {@code Date} or {@code Calendar}
|
||||
* @throws ArithmeticException if the year is over 280 million
|
||||
*/
|
||||
public static Date round(Object date, int field) {
|
||||
public static Date round(final Object date, final int field) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -799,7 +799,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is <code>null</code>
|
||||
* @throws ArithmeticException if the year is over 280 million
|
||||
*/
|
||||
public static Date truncate(Date date, int field) {
|
||||
public static Date truncate(final Date date, final int field) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -824,7 +824,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is <code>null</code>
|
||||
* @throws ArithmeticException if the year is over 280 million
|
||||
*/
|
||||
public static Calendar truncate(Calendar date, int field) {
|
||||
public static Calendar truncate(final Calendar date, final int field) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ public class DateUtils {
|
|||
* @throws ClassCastException if the object type is not a {@code Date} or {@code Calendar}
|
||||
* @throws ArithmeticException if the year is over 280 million
|
||||
*/
|
||||
public static Date truncate(Object date, int field) {
|
||||
public static Date truncate(final Object date, final int field) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -879,7 +879,7 @@ public class DateUtils {
|
|||
* @throws ArithmeticException if the year is over 280 million
|
||||
* @since 2.5
|
||||
*/
|
||||
public static Date ceiling(Date date, int field) {
|
||||
public static Date ceiling(final Date date, final int field) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -905,7 +905,7 @@ public class DateUtils {
|
|||
* @throws ArithmeticException if the year is over 280 million
|
||||
* @since 2.5
|
||||
*/
|
||||
public static Calendar ceiling(Calendar date, int field) {
|
||||
public static Calendar ceiling(final Calendar date, final int field) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -931,7 +931,7 @@ public class DateUtils {
|
|||
* @throws ArithmeticException if the year is over 280 million
|
||||
* @since 2.5
|
||||
*/
|
||||
public static Date ceiling(Object date, int field) {
|
||||
public static Date ceiling(final Object date, final int field) {
|
||||
if (date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -953,7 +953,7 @@ public class DateUtils {
|
|||
* @param modType type to truncate, round or ceiling
|
||||
* @throws ArithmeticException if the year is over 280 million
|
||||
*/
|
||||
private static void modify(Calendar val, int field, int modType) {
|
||||
private static void modify(final Calendar val, final int field, final int modType) {
|
||||
if (val.get(Calendar.YEAR) > 280000000) {
|
||||
throw new ArithmeticException("Calendar value too large for accurate calculations");
|
||||
}
|
||||
|
@ -1116,7 +1116,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is <code>null</code>
|
||||
* @throws IllegalArgumentException if the rangeStyle is invalid
|
||||
*/
|
||||
public static Iterator<Calendar> iterator(Date focus, int rangeStyle) {
|
||||
public static Iterator<Calendar> iterator(final Date focus, final int rangeStyle) {
|
||||
if (focus == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -1149,7 +1149,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is <code>null</code>
|
||||
* @throws IllegalArgumentException if the rangeStyle is invalid
|
||||
*/
|
||||
public static Iterator<Calendar> iterator(Calendar focus, int rangeStyle) {
|
||||
public static Iterator<Calendar> iterator(final Calendar focus, final int rangeStyle) {
|
||||
if (focus == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -1237,7 +1237,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if the date is <code>null</code>
|
||||
* @throws ClassCastException if the object type is not a {@code Date} or {@code Calendar}
|
||||
*/
|
||||
public static Iterator<?> iterator(Object focus, int rangeStyle) {
|
||||
public static Iterator<?> iterator(final Object focus, final int rangeStyle) {
|
||||
if (focus == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -1283,7 +1283,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
public static long getFragmentInMilliseconds(Date date, int fragment) {
|
||||
public static long getFragmentInMilliseconds(final Date date, final int fragment) {
|
||||
return getFragment(date, fragment, Calendar.MILLISECOND);
|
||||
}
|
||||
|
||||
|
@ -1323,7 +1323,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
public static long getFragmentInSeconds(Date date, int fragment) {
|
||||
public static long getFragmentInSeconds(final Date date, final int fragment) {
|
||||
return getFragment(date, fragment, Calendar.SECOND);
|
||||
}
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
public static long getFragmentInMinutes(Date date, int fragment) {
|
||||
public static long getFragmentInMinutes(final Date date, final int fragment) {
|
||||
return getFragment(date, fragment, Calendar.MINUTE);
|
||||
}
|
||||
|
||||
|
@ -1403,7 +1403,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
public static long getFragmentInHours(Date date, int fragment) {
|
||||
public static long getFragmentInHours(final Date date, final int fragment) {
|
||||
return getFragment(date, fragment, Calendar.HOUR_OF_DAY);
|
||||
}
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
public static long getFragmentInDays(Date date, int fragment) {
|
||||
public static long getFragmentInDays(final Date date, final int fragment) {
|
||||
return getFragment(date, fragment, Calendar.DAY_OF_YEAR);
|
||||
}
|
||||
|
||||
|
@ -1483,7 +1483,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
public static long getFragmentInMilliseconds(Calendar calendar, int fragment) {
|
||||
public static long getFragmentInMilliseconds(final Calendar calendar, final int fragment) {
|
||||
return getFragment(calendar, fragment, Calendar.MILLISECOND);
|
||||
}
|
||||
/**
|
||||
|
@ -1522,7 +1522,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
public static long getFragmentInSeconds(Calendar calendar, int fragment) {
|
||||
public static long getFragmentInSeconds(final Calendar calendar, final int fragment) {
|
||||
return getFragment(calendar, fragment, Calendar.SECOND);
|
||||
}
|
||||
|
||||
|
@ -1562,7 +1562,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
public static long getFragmentInMinutes(Calendar calendar, int fragment) {
|
||||
public static long getFragmentInMinutes(final Calendar calendar, final int fragment) {
|
||||
return getFragment(calendar, fragment, Calendar.MINUTE);
|
||||
}
|
||||
|
||||
|
@ -1602,7 +1602,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
public static long getFragmentInHours(Calendar calendar, int fragment) {
|
||||
public static long getFragmentInHours(final Calendar calendar, final int fragment) {
|
||||
return getFragment(calendar, fragment, Calendar.HOUR_OF_DAY);
|
||||
}
|
||||
|
||||
|
@ -1644,7 +1644,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
public static long getFragmentInDays(Calendar calendar, int fragment) {
|
||||
public static long getFragmentInDays(final Calendar calendar, final int fragment) {
|
||||
return getFragment(calendar, fragment, Calendar.DAY_OF_YEAR);
|
||||
}
|
||||
|
||||
|
@ -1659,7 +1659,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
private static long getFragment(Date date, int fragment, int unit) {
|
||||
private static long getFragment(final Date date, final int fragment, final int unit) {
|
||||
if(date == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -1679,7 +1679,7 @@ public class DateUtils {
|
|||
* fragment is not supported
|
||||
* @since 2.4
|
||||
*/
|
||||
private static long getFragment(Calendar calendar, int fragment, int unit) {
|
||||
private static long getFragment(final Calendar calendar, final int fragment, final int unit) {
|
||||
if(calendar == null) {
|
||||
throw new IllegalArgumentException("The date must not be null");
|
||||
}
|
||||
|
@ -1734,7 +1734,7 @@ public class DateUtils {
|
|||
* @see #truncatedEquals(Date, Date, int)
|
||||
* @since 3.0
|
||||
*/
|
||||
public static boolean truncatedEquals(Calendar cal1, Calendar cal2, int field) {
|
||||
public static boolean truncatedEquals(final Calendar cal1, final Calendar cal2, final int field) {
|
||||
return truncatedCompareTo(cal1, cal2, field) == 0;
|
||||
}
|
||||
|
||||
|
@ -1751,7 +1751,7 @@ public class DateUtils {
|
|||
* @see #truncatedEquals(Calendar, Calendar, int)
|
||||
* @since 3.0
|
||||
*/
|
||||
public static boolean truncatedEquals(Date date1, Date date2, int field) {
|
||||
public static boolean truncatedEquals(final Date date1, final Date date2, final int field) {
|
||||
return truncatedCompareTo(date1, date2, field) == 0;
|
||||
}
|
||||
|
||||
|
@ -1769,7 +1769,7 @@ public class DateUtils {
|
|||
* @see #truncatedCompareTo(Date, Date, int)
|
||||
* @since 3.0
|
||||
*/
|
||||
public static int truncatedCompareTo(Calendar cal1, Calendar cal2, int field) {
|
||||
public static int truncatedCompareTo(final Calendar cal1, final Calendar cal2, final int field) {
|
||||
Calendar truncatedCal1 = truncate(cal1, field);
|
||||
Calendar truncatedCal2 = truncate(cal2, field);
|
||||
return truncatedCal1.compareTo(truncatedCal2);
|
||||
|
@ -1789,7 +1789,7 @@ public class DateUtils {
|
|||
* @see #truncatedCompareTo(Date, Date, int)
|
||||
* @since 3.0
|
||||
*/
|
||||
public static int truncatedCompareTo(Date date1, Date date2, int field) {
|
||||
public static int truncatedCompareTo(final Date date1, final Date date2, final int field) {
|
||||
Date truncatedDate1 = truncate(date1, field);
|
||||
Date truncatedDate2 = truncate(date2, field);
|
||||
return truncatedDate1.compareTo(truncatedDate2);
|
||||
|
@ -1804,7 +1804,7 @@ public class DateUtils {
|
|||
* @throws IllegalArgumentException if date can't be represented in milliseconds
|
||||
* @since 2.4
|
||||
*/
|
||||
private static long getMillisPerUnit(int unit) {
|
||||
private static long getMillisPerUnit(final int unit) {
|
||||
long result = Long.MAX_VALUE;
|
||||
switch (unit) {
|
||||
case Calendar.DAY_OF_YEAR:
|
||||
|
@ -1842,7 +1842,7 @@ public class DateUtils {
|
|||
* @param startFinal start date (inclusive)
|
||||
* @param endFinal end date (inclusive)
|
||||
*/
|
||||
DateIterator(Calendar startFinal, Calendar endFinal) {
|
||||
DateIterator(final Calendar startFinal, final Calendar endFinal) {
|
||||
super();
|
||||
this.endFinal = endFinal;
|
||||
spot = startFinal;
|
||||
|
|
|
@ -72,7 +72,7 @@ public class DurationFormatUtils {
|
|||
* @param durationMillis the duration to format
|
||||
* @return the formatted duration, not null
|
||||
*/
|
||||
public static String formatDurationHMS(long durationMillis) {
|
||||
public static String formatDurationHMS(final long durationMillis) {
|
||||
return formatDuration(durationMillis, "H:mm:ss.SSS");
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class DurationFormatUtils {
|
|||
* @param durationMillis the duration to format
|
||||
* @return the formatted duration, not null
|
||||
*/
|
||||
public static String formatDurationISO(long durationMillis) {
|
||||
public static String formatDurationISO(final long durationMillis) {
|
||||
return formatDuration(durationMillis, ISO_EXTENDED_FORMAT_PATTERN, false);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class DurationFormatUtils {
|
|||
* @param format the way in which to format the duration, not null
|
||||
* @return the formatted duration, not null
|
||||
*/
|
||||
public static String formatDuration(long durationMillis, String format) {
|
||||
public static String formatDuration(final long durationMillis, final String format) {
|
||||
return formatDuration(durationMillis, format, true);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class DurationFormatUtils {
|
|||
* @param padWithZeros whether to pad the left hand side of numbers with 0's
|
||||
* @return the formatted duration, not null
|
||||
*/
|
||||
public static String formatDuration(long durationMillis, String format, boolean padWithZeros) {
|
||||
public static String formatDuration(long durationMillis, final String format, final boolean padWithZeros) {
|
||||
|
||||
Token[] tokens = lexx(format);
|
||||
|
||||
|
@ -164,9 +164,9 @@ public class DurationFormatUtils {
|
|||
* @return the formatted text in days/hours/minutes/seconds, not null
|
||||
*/
|
||||
public static String formatDurationWords(
|
||||
long durationMillis,
|
||||
boolean suppressLeadingZeroElements,
|
||||
boolean suppressTrailingZeroElements) {
|
||||
final long durationMillis,
|
||||
final boolean suppressLeadingZeroElements,
|
||||
final boolean suppressTrailingZeroElements) {
|
||||
|
||||
// This method is generally replacable by the format method, but
|
||||
// there are a series of tweaks and special cases that require
|
||||
|
@ -226,7 +226,7 @@ public class DurationFormatUtils {
|
|||
* @param endMillis the end of the duration to format
|
||||
* @return the formatted duration, not null
|
||||
*/
|
||||
public static String formatPeriodISO(long startMillis, long endMillis) {
|
||||
public static String formatPeriodISO(final long startMillis, final long endMillis) {
|
||||
return formatPeriod(startMillis, endMillis, ISO_EXTENDED_FORMAT_PATTERN, false, TimeZone.getDefault());
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ public class DurationFormatUtils {
|
|||
* @param format the way in which to format the duration, not null
|
||||
* @return the formatted duration, not null
|
||||
*/
|
||||
public static String formatPeriod(long startMillis, long endMillis, String format) {
|
||||
public static String formatPeriod(final long startMillis, final long endMillis, final String format) {
|
||||
return formatPeriod(startMillis, endMillis, format, true, TimeZone.getDefault());
|
||||
}
|
||||
|
||||
|
@ -266,8 +266,8 @@ public class DurationFormatUtils {
|
|||
* @param timezone the millis are defined in
|
||||
* @return the formatted duration, not null
|
||||
*/
|
||||
public static String formatPeriod(long startMillis, long endMillis, String format, boolean padWithZeros,
|
||||
TimeZone timezone) {
|
||||
public static String formatPeriod(final long startMillis, final long endMillis, final String format, final boolean padWithZeros,
|
||||
final TimeZone timezone) {
|
||||
|
||||
// Used to optimise for differences under 28 days and
|
||||
// called formatDuration(millis, format); however this did not work
|
||||
|
@ -411,8 +411,8 @@ public class DurationFormatUtils {
|
|||
* @param padWithZeros whether to pad
|
||||
* @return the formatted string
|
||||
*/
|
||||
static String format(Token[] tokens, int years, int months, int days, int hours, int minutes, int seconds,
|
||||
int milliseconds, boolean padWithZeros) {
|
||||
static String format(final Token[] tokens, final int years, final int months, final int days, final int hours, final int minutes, final int seconds,
|
||||
int milliseconds, final boolean padWithZeros) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
boolean lastOutputSeconds = false;
|
||||
int sz = tokens.length;
|
||||
|
@ -480,7 +480,7 @@ public class DurationFormatUtils {
|
|||
* @param format the format to parse, not null
|
||||
* @return array of Token[]
|
||||
*/
|
||||
static Token[] lexx(String format) {
|
||||
static Token[] lexx(final String format) {
|
||||
char[] array = format.toCharArray();
|
||||
ArrayList<Token> list = new ArrayList<Token>(array.length);
|
||||
|
||||
|
@ -551,7 +551,7 @@ public class DurationFormatUtils {
|
|||
* @param value to look for
|
||||
* @return boolean <code>true</code> if contained
|
||||
*/
|
||||
static boolean containsTokenWithValue(Token[] tokens, Object value) {
|
||||
static boolean containsTokenWithValue(final Token[] tokens, final Object value) {
|
||||
int sz = tokens.length;
|
||||
for (int i = 0; i < sz; i++) {
|
||||
if (tokens[i].getValue() == value) {
|
||||
|
@ -569,7 +569,7 @@ public class DurationFormatUtils {
|
|||
*
|
||||
* @param value to wrap
|
||||
*/
|
||||
Token(Object value) {
|
||||
Token(final Object value) {
|
||||
this.value = value;
|
||||
this.count = 1;
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ public class DurationFormatUtils {
|
|||
* @param value to wrap
|
||||
* @param count to wrap
|
||||
*/
|
||||
Token(Object value, int count) {
|
||||
Token(final Object value, final int count) {
|
||||
this.value = value;
|
||||
this.count = count;
|
||||
}
|
||||
|
@ -618,7 +618,7 @@ public class DurationFormatUtils {
|
|||
* @return boolean <code>true</code> if equal
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj2) {
|
||||
public boolean equals(final Object obj2) {
|
||||
if (obj2 instanceof Token) {
|
||||
Token tok2 = (Token) obj2;
|
||||
if (this.value.getClass() != tok2.value.getClass()) {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
|
||||
private static final FormatCache<FastDateFormat> cache= new FormatCache<FastDateFormat>() {
|
||||
@Override
|
||||
protected FastDateFormat createInstance(String pattern, TimeZone timeZone, Locale locale) {
|
||||
protected FastDateFormat createInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
|
||||
return new FastDateFormat(pattern, timeZone, locale);
|
||||
}
|
||||
};
|
||||
|
@ -115,7 +115,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @return a pattern based date/time formatter
|
||||
* @throws IllegalArgumentException if pattern is invalid
|
||||
*/
|
||||
public static FastDateFormat getInstance(String pattern) {
|
||||
public static FastDateFormat getInstance(final String pattern) {
|
||||
return cache.getInstance(pattern, null, null);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @return a pattern based date/time formatter
|
||||
* @throws IllegalArgumentException if pattern is invalid
|
||||
*/
|
||||
public static FastDateFormat getInstance(String pattern, TimeZone timeZone) {
|
||||
public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone) {
|
||||
return cache.getInstance(pattern, timeZone, null);
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @return a pattern based date/time formatter
|
||||
* @throws IllegalArgumentException if pattern is invalid
|
||||
*/
|
||||
public static FastDateFormat getInstance(String pattern, Locale locale) {
|
||||
public static FastDateFormat getInstance(final String pattern, final Locale locale) {
|
||||
return cache.getInstance(pattern, null, locale);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @throws IllegalArgumentException if pattern is invalid
|
||||
* or {@code null}
|
||||
*/
|
||||
public static FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale) {
|
||||
public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
|
||||
return cache.getInstance(pattern, timeZone, locale);
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* pattern defined
|
||||
* @since 2.1
|
||||
*/
|
||||
public static FastDateFormat getDateInstance(int style) {
|
||||
public static FastDateFormat getDateInstance(final int style) {
|
||||
return cache.getDateTimeInstance(style, null, null, null);
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* pattern defined
|
||||
* @since 2.1
|
||||
*/
|
||||
public static FastDateFormat getDateInstance(int style, Locale locale) {
|
||||
public static FastDateFormat getDateInstance(final int style, final Locale locale) {
|
||||
return cache.getDateTimeInstance(style, null, null, locale);
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* pattern defined
|
||||
* @since 2.1
|
||||
*/
|
||||
public static FastDateFormat getDateInstance(int style, TimeZone timeZone) {
|
||||
public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone) {
|
||||
return cache.getDateTimeInstance(style, null, timeZone, null);
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @throws IllegalArgumentException if the Locale has no date
|
||||
* pattern defined
|
||||
*/
|
||||
public static FastDateFormat getDateInstance(int style, TimeZone timeZone, Locale locale) {
|
||||
public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone, final Locale locale) {
|
||||
return cache.getDateTimeInstance(style, null, timeZone, locale);
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* pattern defined
|
||||
* @since 2.1
|
||||
*/
|
||||
public static FastDateFormat getTimeInstance(int style) {
|
||||
public static FastDateFormat getTimeInstance(final int style) {
|
||||
return cache.getDateTimeInstance(null, style, null, null);
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* pattern defined
|
||||
* @since 2.1
|
||||
*/
|
||||
public static FastDateFormat getTimeInstance(int style, Locale locale) {
|
||||
public static FastDateFormat getTimeInstance(final int style, final Locale locale) {
|
||||
return cache.getDateTimeInstance(null, style, null, locale);
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* pattern defined
|
||||
* @since 2.1
|
||||
*/
|
||||
public static FastDateFormat getTimeInstance(int style, TimeZone timeZone) {
|
||||
public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone) {
|
||||
return cache.getDateTimeInstance(null, style, timeZone, null);
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @throws IllegalArgumentException if the Locale has no time
|
||||
* pattern defined
|
||||
*/
|
||||
public static FastDateFormat getTimeInstance(int style, TimeZone timeZone, Locale locale) {
|
||||
public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone, final Locale locale) {
|
||||
return cache.getDateTimeInstance(null, style, timeZone, locale);
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* pattern defined
|
||||
* @since 2.1
|
||||
*/
|
||||
public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle) {
|
||||
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle) {
|
||||
return cache.getDateTimeInstance(dateStyle, timeStyle, null, null);
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* pattern defined
|
||||
* @since 2.1
|
||||
*/
|
||||
public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) {
|
||||
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final Locale locale) {
|
||||
return cache.getDateTimeInstance(dateStyle, timeStyle, null, locale);
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* pattern defined
|
||||
* @since 2.1
|
||||
*/
|
||||
public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone) {
|
||||
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone) {
|
||||
return getDateTimeInstance(dateStyle, timeStyle, timeZone, null);
|
||||
}
|
||||
/**
|
||||
|
@ -351,7 +351,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* pattern defined
|
||||
*/
|
||||
public static FastDateFormat getDateTimeInstance(
|
||||
int dateStyle, int timeStyle, TimeZone timeZone, Locale locale) {
|
||||
final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
|
||||
return cache.getDateTimeInstance(dateStyle, timeStyle, timeZone, locale);
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @param locale non-null locale to use
|
||||
* @throws NullPointerException if pattern, timeZone, or locale is null.
|
||||
*/
|
||||
protected FastDateFormat(String pattern, TimeZone timeZone, Locale locale) {
|
||||
protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale) {
|
||||
printer= new FastDatePrinter(pattern, timeZone, locale);
|
||||
parser= new FastDateParser(pattern, timeZone, locale);
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @return the buffer passed in
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
|
||||
public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
|
||||
return printer.format(obj, toAppendTo, pos);
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @since 2.1
|
||||
*/
|
||||
@Override
|
||||
public String format(long millis) {
|
||||
public String format(final long millis) {
|
||||
return printer.format(millis);
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @return the formatted string
|
||||
*/
|
||||
@Override
|
||||
public String format(Date date) {
|
||||
public String format(final Date date) {
|
||||
return printer.format(date);
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @return the formatted string
|
||||
*/
|
||||
@Override
|
||||
public String format(Calendar calendar) {
|
||||
public String format(final Calendar calendar) {
|
||||
return printer.format(calendar);
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @since 2.1
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer format(long millis, StringBuffer buf) {
|
||||
public StringBuffer format(final long millis, final StringBuffer buf) {
|
||||
return printer.format(millis, buf);
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @return the specified string buffer
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer format(Date date, StringBuffer buf) {
|
||||
public StringBuffer format(final Date date, final StringBuffer buf) {
|
||||
return printer.format(date, buf);
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @return the specified string buffer
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer format(Calendar calendar, StringBuffer buf) {
|
||||
public StringBuffer format(final Calendar calendar, final StringBuffer buf) {
|
||||
return printer.format(calendar, buf);
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @see DateParser#parse(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Date parse(String source) throws ParseException {
|
||||
public Date parse(final String source) throws ParseException {
|
||||
return parser.parse(source);
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @see DateParser#parse(java.lang.String, java.text.ParsePosition)
|
||||
*/
|
||||
@Override
|
||||
public Date parse(String source, ParsePosition pos) {
|
||||
public Date parse(final String source, final ParsePosition pos) {
|
||||
return parser.parse(source, pos);
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition)
|
||||
*/
|
||||
@Override
|
||||
public Object parseObject(String source, ParsePosition pos) {
|
||||
public Object parseObject(final String source, final ParsePosition pos) {
|
||||
return parser.parseObject(source, pos);
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @return {@code true} if equal
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj instanceof FastDateFormat == false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @param buf the buffer to format into
|
||||
* @return the specified string buffer
|
||||
*/
|
||||
protected StringBuffer applyRules(Calendar calendar, StringBuffer buf) {
|
||||
protected StringBuffer applyRules(final Calendar calendar, final StringBuffer buf) {
|
||||
return printer.applyRules(calendar, buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param timeZone non-null time zone to use
|
||||
* @param locale non-null locale
|
||||
*/
|
||||
protected FastDateParser(String pattern, TimeZone timeZone, Locale locale) {
|
||||
protected FastDateParser(final String pattern, final TimeZone timeZone, final Locale locale) {
|
||||
this.pattern = pattern;
|
||||
this.timeZone = timeZone;
|
||||
this.locale = locale;
|
||||
|
@ -185,7 +185,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @return <code>true</code>if equal to this instance
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (! (obj instanceof FastDateParser) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @throws IOException if there is an IO issue.
|
||||
* @throws ClassNotFoundException if a class cannot be found.
|
||||
*/
|
||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
in.defaultReadObject();
|
||||
init();
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @see org.apache.commons.lang3.time.DateParser#parseObject(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Object parseObject(String source) throws ParseException {
|
||||
public Object parseObject(final String source) throws ParseException {
|
||||
return parse(source);
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @see org.apache.commons.lang3.time.DateParser#parse(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Date parse(String source) throws ParseException {
|
||||
public Date parse(final String source) throws ParseException {
|
||||
Date date= parse(source, new ParsePosition(0));
|
||||
if(date==null) {
|
||||
// Add a note re supported date range
|
||||
|
@ -260,7 +260,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @see org.apache.commons.lang3.time.DateParser#parseObject(java.lang.String, java.text.ParsePosition)
|
||||
*/
|
||||
@Override
|
||||
public Object parseObject(String source, ParsePosition pos) {
|
||||
public Object parseObject(final String source, final ParsePosition pos) {
|
||||
return parse(source, pos);
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @see org.apache.commons.lang3.time.DateParser#parse(java.lang.String, java.text.ParsePosition)
|
||||
*/
|
||||
@Override
|
||||
public Date parse(String source, ParsePosition pos) {
|
||||
public Date parse(final String source, final ParsePosition pos) {
|
||||
int offset= pos.getIndex();
|
||||
Matcher matcher= parsePattern.matcher(source.substring(offset));
|
||||
if(!matcher.lookingAt()) {
|
||||
|
@ -296,7 +296,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param unquote If true, replace two success quotes ('') with single quote (')
|
||||
* @return The <code>StringBuilder</code>
|
||||
*/
|
||||
private static StringBuilder escapeRegex(StringBuilder regex, String value, boolean unquote) {
|
||||
private static StringBuilder escapeRegex(final StringBuilder regex, final String value, final boolean unquote) {
|
||||
regex.append("\\Q");
|
||||
for(int i= 0; i<value.length(); ++i) {
|
||||
char c= value.charAt(i);
|
||||
|
@ -342,7 +342,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param locale The locale of display names
|
||||
* @return A Map of the field key / value pairs
|
||||
*/
|
||||
private static Map<String, Integer> getDisplayNames(int field, Calendar definingCalendar, Locale locale) {
|
||||
private static Map<String, Integer> getDisplayNames(final int field, final Calendar definingCalendar, final Locale locale) {
|
||||
return definingCalendar.getDisplayNames(field, Calendar.ALL_STYLES, locale);
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param twoDigitYear The year to adjust
|
||||
* @return A value within -80 and +20 years from instantiation of this instance
|
||||
*/
|
||||
int adjustYear(int twoDigitYear) {
|
||||
int adjustYear(final int twoDigitYear) {
|
||||
int trial= twoDigitYear + thisYear - thisYear%100;
|
||||
if(trial < thisYear+20) {
|
||||
return trial;
|
||||
|
@ -397,7 +397,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param cal The <code>Calendar</code> to set
|
||||
* @param value The parsed field to translate and set in cal
|
||||
*/
|
||||
void setCalendar(FastDateParser parser, Calendar cal, String value) {
|
||||
void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
|
||||
|
||||
}
|
||||
/**
|
||||
|
@ -424,7 +424,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param definingCalendar The calendar to obtain the short and long values
|
||||
* @return The Strategy that will handle parsing for the field
|
||||
*/
|
||||
private Strategy getStrategy(String formatField, Calendar definingCalendar) {
|
||||
private Strategy getStrategy(String formatField, final Calendar definingCalendar) {
|
||||
switch(formatField.charAt(0)) {
|
||||
case '\'':
|
||||
if(formatField.length()>2) {
|
||||
|
@ -481,7 +481,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param field The Calendar field
|
||||
* @return a cache of Locale to Strategy
|
||||
*/
|
||||
private static ConcurrentMap<Locale, Strategy> getCache(int field) {
|
||||
private static ConcurrentMap<Locale, Strategy> getCache(final int field) {
|
||||
synchronized(caches) {
|
||||
if(caches[field]==null) {
|
||||
caches[field]= new ConcurrentHashMap<Locale,Strategy>(3);
|
||||
|
@ -497,7 +497,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param definingCalendar The calendar to obtain the short and long values
|
||||
* @return a TextStrategy for the field and Locale
|
||||
*/
|
||||
private Strategy getLocaleSpecificStrategy(int field, Calendar definingCalendar) {
|
||||
private Strategy getLocaleSpecificStrategy(final int field, final Calendar definingCalendar) {
|
||||
ConcurrentMap<Locale,Strategy> cache = getCache(field);
|
||||
Strategy strategy= cache.get(Integer.valueOf(field));
|
||||
if(strategy==null) {
|
||||
|
@ -522,7 +522,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* Construct a Strategy that ensures the formatField has literal text
|
||||
* @param formatField The literal text to match
|
||||
*/
|
||||
CopyQuotedStrategy(String formatField) {
|
||||
CopyQuotedStrategy(final String formatField) {
|
||||
this.formatField= formatField;
|
||||
}
|
||||
|
||||
|
@ -542,7 +542,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
boolean addRegex(FastDateParser parser, StringBuilder regex) {
|
||||
boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
|
||||
escapeRegex(regex, formatField, true);
|
||||
return false;
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* Construct a Strategy that parses a Text field
|
||||
* @param field The Calendar field
|
||||
*/
|
||||
TextStrategy(int field, Calendar definingCalendar, Locale locale) {
|
||||
TextStrategy(final int field, final Calendar definingCalendar, final Locale locale) {
|
||||
this.field= field;
|
||||
this.keyValues= getDisplayNames(field, definingCalendar, locale);
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
boolean addRegex(FastDateParser parser, StringBuilder regex) {
|
||||
boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
|
||||
regex.append('(');
|
||||
for(String textKeyValue : keyValues.keySet()) {
|
||||
escapeRegex(regex, textKeyValue, false).append('|');
|
||||
|
@ -581,7 +581,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
void setCalendar(FastDateParser parser, Calendar cal, String value) {
|
||||
void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
|
||||
Integer iVal = keyValues.get(value);
|
||||
if(iVal == null) {
|
||||
StringBuilder sb= new StringBuilder(value);
|
||||
|
@ -607,7 +607,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* Construct a Strategy that parses a Number field
|
||||
* @param field The Calendar field
|
||||
*/
|
||||
NumberStrategy(int field) {
|
||||
NumberStrategy(final int field) {
|
||||
this.field= field;
|
||||
}
|
||||
|
||||
|
@ -623,7 +623,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
boolean addRegex(FastDateParser parser, StringBuilder regex) {
|
||||
boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
|
||||
if(parser.isNextNumber()) {
|
||||
regex.append("(\\p{IsNd}{").append(parser.getFieldWidth()).append("}+)");
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
void setCalendar(FastDateParser parser, Calendar cal, String value) {
|
||||
void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
|
||||
cal.set(field, modify(Integer.parseInt(value)));
|
||||
}
|
||||
|
||||
|
@ -646,7 +646,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* @param iValue The parsed integer
|
||||
* @return The modified value
|
||||
*/
|
||||
int modify(int iValue) {
|
||||
int modify(final int iValue) {
|
||||
return iValue;
|
||||
}
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
void setCalendar(FastDateParser parser, Calendar cal, String value) {
|
||||
void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
|
||||
int iValue= Integer.parseInt(value);
|
||||
if(iValue<100) {
|
||||
iValue= parser.adjustYear(iValue);
|
||||
|
@ -677,7 +677,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* Construct a Strategy that parses a TimeZone
|
||||
* @param locale The Locale
|
||||
*/
|
||||
TimeZoneStrategy(Locale locale) {
|
||||
TimeZoneStrategy(final Locale locale) {
|
||||
for(String id : TimeZone.getAvailableIDs()) {
|
||||
if(id.startsWith("GMT")) {
|
||||
continue;
|
||||
|
@ -703,7 +703,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
boolean addRegex(FastDateParser parser, StringBuilder regex) {
|
||||
boolean addRegex(final FastDateParser parser, final StringBuilder regex) {
|
||||
regex.append(validTimeZoneChars);
|
||||
return true;
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
void setCalendar(FastDateParser parser, Calendar cal, String value) {
|
||||
void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
|
||||
TimeZone tz;
|
||||
if(value.charAt(0)=='+' || value.charAt(0)=='-') {
|
||||
tz= TimeZone.getTimeZone("GMT"+value);
|
||||
|
@ -732,7 +732,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
|
||||
private static final Strategy NUMBER_MONTH_STRATEGY = new NumberStrategy(Calendar.MONTH) {
|
||||
@Override
|
||||
int modify(int iValue) {
|
||||
int modify(final int iValue) {
|
||||
return iValue-1;
|
||||
}
|
||||
};
|
||||
|
@ -745,13 +745,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 MODULO_HOUR_OF_DAY_STRATEGY = new NumberStrategy(Calendar.HOUR_OF_DAY) {
|
||||
@Override
|
||||
int modify(int iValue) {
|
||||
int modify(final int iValue) {
|
||||
return iValue%24;
|
||||
}
|
||||
};
|
||||
private static final Strategy MODULO_HOUR_STRATEGY = new NumberStrategy(Calendar.HOUR) {
|
||||
@Override
|
||||
int modify(int iValue) {
|
||||
int modify(final int iValue) {
|
||||
return iValue%12;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -133,7 +133,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @param locale non-null locale to use
|
||||
* @throws NullPointerException if pattern, timeZone, or locale is null.
|
||||
*/
|
||||
protected FastDatePrinter(String pattern, TimeZone timeZone, Locale locale) {
|
||||
protected FastDatePrinter(final String pattern, final TimeZone timeZone, final Locale locale) {
|
||||
mPattern = pattern;
|
||||
mTimeZone = timeZone;
|
||||
mLocale = locale;
|
||||
|
@ -294,7 +294,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @param indexRef index references
|
||||
* @return parsed token
|
||||
*/
|
||||
protected String parseToken(String pattern, int[] indexRef) {
|
||||
protected String parseToken(final String pattern, final int[] indexRef) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
||||
int i = indexRef[0];
|
||||
|
@ -353,7 +353,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @param padding the padding required
|
||||
* @return a new rule with the correct padding
|
||||
*/
|
||||
protected NumberRule selectNumberRule(int field, int padding) {
|
||||
protected NumberRule selectNumberRule(final int field, final int padding) {
|
||||
switch (padding) {
|
||||
case 1:
|
||||
return new UnpaddedNumberField(field);
|
||||
|
@ -376,7 +376,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @return the buffer passed in
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
|
||||
public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
|
||||
if (obj instanceof Date) {
|
||||
return format((Date) obj, toAppendTo);
|
||||
} else if (obj instanceof Calendar) {
|
||||
|
@ -393,13 +393,13 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @see org.apache.commons.lang3.time.DatePrinter#format(long)
|
||||
*/
|
||||
@Override
|
||||
public String format(long millis) {
|
||||
public String format(final long millis) {
|
||||
Calendar c = newCalendar(); // hard code GregorianCalendar
|
||||
c.setTimeInMillis(millis);
|
||||
return applyRulesToString(c);
|
||||
}
|
||||
|
||||
private String applyRulesToString(Calendar c) {
|
||||
private String applyRulesToString(final Calendar c) {
|
||||
return applyRules(c, new StringBuffer(mMaxLengthEstimate)).toString();
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Date)
|
||||
*/
|
||||
@Override
|
||||
public String format(Date date) {
|
||||
public String format(final Date date) {
|
||||
Calendar c = newCalendar(); // hard code GregorianCalendar
|
||||
c.setTime(date);
|
||||
return applyRulesToString(c);
|
||||
|
@ -422,7 +422,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Calendar)
|
||||
*/
|
||||
@Override
|
||||
public String format(Calendar calendar) {
|
||||
public String format(final Calendar calendar) {
|
||||
return format(calendar, new StringBuffer(mMaxLengthEstimate)).toString();
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @see org.apache.commons.lang3.time.DatePrinter#format(long, java.lang.StringBuffer)
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer format(long millis, StringBuffer buf) {
|
||||
public StringBuffer format(final long millis, final StringBuffer buf) {
|
||||
return format(new Date(millis), buf);
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Date, java.lang.StringBuffer)
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer format(Date date, StringBuffer buf) {
|
||||
public StringBuffer format(final Date date, final StringBuffer buf) {
|
||||
Calendar c = newCalendar(); // hard code GregorianCalendar
|
||||
c.setTime(date);
|
||||
return applyRules(c, buf);
|
||||
|
@ -448,7 +448,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @see org.apache.commons.lang3.time.DatePrinter#format(java.util.Calendar, java.lang.StringBuffer)
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer format(Calendar calendar, StringBuffer buf) {
|
||||
public StringBuffer format(final Calendar calendar, final StringBuffer buf) {
|
||||
return applyRules(calendar, buf);
|
||||
}
|
||||
|
||||
|
@ -460,7 +460,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @param buf the buffer to format into
|
||||
* @return the specified string buffer
|
||||
*/
|
||||
protected StringBuffer applyRules(Calendar calendar, StringBuffer buf) {
|
||||
protected StringBuffer applyRules(final Calendar calendar, final StringBuffer buf) {
|
||||
for (Rule rule : mRules) {
|
||||
rule.appendTo(buf, calendar);
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @return {@code true} if equal
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj instanceof FastDatePrinter == false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @throws IOException if there is an IO issue.
|
||||
* @throws ClassNotFoundException if a class cannot be found.
|
||||
*/
|
||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
in.defaultReadObject();
|
||||
init();
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
*
|
||||
* @param value the character literal
|
||||
*/
|
||||
CharacterLiteral(char value) {
|
||||
CharacterLiteral(final char value) {
|
||||
mValue = value;
|
||||
}
|
||||
|
||||
|
@ -623,7 +623,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
buffer.append(mValue);
|
||||
}
|
||||
}
|
||||
|
@ -640,7 +640,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
*
|
||||
* @param value the string literal
|
||||
*/
|
||||
StringLiteral(String value) {
|
||||
StringLiteral(final String value) {
|
||||
mValue = value;
|
||||
}
|
||||
|
||||
|
@ -656,7 +656,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
buffer.append(mValue);
|
||||
}
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @param field the field
|
||||
* @param values the field values
|
||||
*/
|
||||
TextField(int field, String[] values) {
|
||||
TextField(final int field, final String[] values) {
|
||||
mField = field;
|
||||
mValues = values;
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
buffer.append(mValues[calendar.get(mField)]);
|
||||
}
|
||||
}
|
||||
|
@ -715,7 +715,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
*
|
||||
* @param field the field
|
||||
*/
|
||||
UnpaddedNumberField(int field) {
|
||||
UnpaddedNumberField(final int field) {
|
||||
mField = field;
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
appendTo(buffer, calendar.get(mField));
|
||||
}
|
||||
|
||||
|
@ -739,7 +739,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final void appendTo(StringBuffer buffer, int value) {
|
||||
public final void appendTo(final StringBuffer buffer, final int value) {
|
||||
if (value < 10) {
|
||||
buffer.append((char)(value + '0'));
|
||||
} else if (value < 100) {
|
||||
|
@ -777,7 +777,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
appendTo(buffer, calendar.get(Calendar.MONTH) + 1);
|
||||
}
|
||||
|
||||
|
@ -785,7 +785,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final void appendTo(StringBuffer buffer, int value) {
|
||||
public final void appendTo(final StringBuffer buffer, final int value) {
|
||||
if (value < 10) {
|
||||
buffer.append((char)(value + '0'));
|
||||
} else {
|
||||
|
@ -808,7 +808,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @param field the field
|
||||
* @param size size of the output field
|
||||
*/
|
||||
PaddedNumberField(int field, int size) {
|
||||
PaddedNumberField(final int field, final int size) {
|
||||
if (size < 3) {
|
||||
// Should use UnpaddedNumberField or TwoDigitNumberField.
|
||||
throw new IllegalArgumentException();
|
||||
|
@ -829,7 +829,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
appendTo(buffer, calendar.get(mField));
|
||||
}
|
||||
|
||||
|
@ -837,7 +837,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final void appendTo(StringBuffer buffer, int value) {
|
||||
public final void appendTo(final StringBuffer buffer, final int value) {
|
||||
if (value < 100) {
|
||||
for (int i = mSize; --i >= 2; ) {
|
||||
buffer.append('0');
|
||||
|
@ -871,7 +871,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
*
|
||||
* @param field the field
|
||||
*/
|
||||
TwoDigitNumberField(int field) {
|
||||
TwoDigitNumberField(final int field) {
|
||||
mField = field;
|
||||
}
|
||||
|
||||
|
@ -887,7 +887,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
appendTo(buffer, calendar.get(mField));
|
||||
}
|
||||
|
||||
|
@ -895,7 +895,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final void appendTo(StringBuffer buffer, int value) {
|
||||
public final void appendTo(final StringBuffer buffer, final int value) {
|
||||
if (value < 100) {
|
||||
buffer.append((char)(value / 10 + '0'));
|
||||
buffer.append((char)(value % 10 + '0'));
|
||||
|
@ -930,7 +930,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
appendTo(buffer, calendar.get(Calendar.YEAR) % 100);
|
||||
}
|
||||
|
||||
|
@ -938,7 +938,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final void appendTo(StringBuffer buffer, int value) {
|
||||
public final void appendTo(final StringBuffer buffer, final int value) {
|
||||
buffer.append((char)(value / 10 + '0'));
|
||||
buffer.append((char)(value % 10 + '0'));
|
||||
}
|
||||
|
@ -969,7 +969,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
appendTo(buffer, calendar.get(Calendar.MONTH) + 1);
|
||||
}
|
||||
|
||||
|
@ -977,7 +977,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final void appendTo(StringBuffer buffer, int value) {
|
||||
public final void appendTo(final StringBuffer buffer, final int value) {
|
||||
buffer.append((char)(value / 10 + '0'));
|
||||
buffer.append((char)(value % 10 + '0'));
|
||||
}
|
||||
|
@ -995,7 +995,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
*
|
||||
* @param rule the rule
|
||||
*/
|
||||
TwelveHourField(NumberRule rule) {
|
||||
TwelveHourField(final NumberRule rule) {
|
||||
mRule = rule;
|
||||
}
|
||||
|
||||
|
@ -1011,7 +1011,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
int value = calendar.get(Calendar.HOUR);
|
||||
if (value == 0) {
|
||||
value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
|
||||
|
@ -1023,7 +1023,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, int value) {
|
||||
public void appendTo(final StringBuffer buffer, final int value) {
|
||||
mRule.appendTo(buffer, value);
|
||||
}
|
||||
}
|
||||
|
@ -1040,7 +1040,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
*
|
||||
* @param rule the rule
|
||||
*/
|
||||
TwentyFourHourField(NumberRule rule) {
|
||||
TwentyFourHourField(final NumberRule rule) {
|
||||
mRule = rule;
|
||||
}
|
||||
|
||||
|
@ -1056,7 +1056,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
int value = calendar.get(Calendar.HOUR_OF_DAY);
|
||||
if (value == 0) {
|
||||
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
|
||||
|
@ -1068,7 +1068,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, int value) {
|
||||
public void appendTo(final StringBuffer buffer, final int value) {
|
||||
mRule.appendTo(buffer, value);
|
||||
}
|
||||
}
|
||||
|
@ -1086,7 +1086,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @param locale the locale to use
|
||||
* @return the textual name of the time zone
|
||||
*/
|
||||
static String getTimeZoneDisplay(TimeZone tz, boolean daylight, int style, Locale locale) {
|
||||
static String getTimeZoneDisplay(final TimeZone tz, final boolean daylight, final int style, final Locale locale) {
|
||||
TimeZoneDisplayKey key = new TimeZoneDisplayKey(tz, daylight, style, locale);
|
||||
String value = cTimeZoneDisplayCache.get(key);
|
||||
if (value == null) {
|
||||
|
@ -1116,7 +1116,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @param locale the locale
|
||||
* @param style the style
|
||||
*/
|
||||
TimeZoneNameRule(TimeZone timeZone, Locale locale, int style) {
|
||||
TimeZoneNameRule(final TimeZone timeZone, final Locale locale, final int style) {
|
||||
mLocale = locale;
|
||||
mStyle = style;
|
||||
|
||||
|
@ -1139,7 +1139,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
TimeZone zone = calendar.getTimeZone();
|
||||
if (zone.useDaylightTime()
|
||||
&& calendar.get(Calendar.DST_OFFSET) != 0) {
|
||||
|
@ -1165,7 +1165,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
*
|
||||
* @param colon add colon between HH and MM in the output if {@code true}
|
||||
*/
|
||||
TimeZoneNumberRule(boolean colon) {
|
||||
TimeZoneNumberRule(final boolean colon) {
|
||||
mColon = colon;
|
||||
}
|
||||
|
||||
|
@ -1181,7 +1181,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void appendTo(StringBuffer buffer, Calendar calendar) {
|
||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||
int offset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
|
||||
|
||||
if (offset < 0) {
|
||||
|
@ -1222,8 +1222,8 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* @param style the timezone style
|
||||
* @param locale the timezone locale
|
||||
*/
|
||||
TimeZoneDisplayKey(TimeZone timeZone,
|
||||
boolean daylight, int style, Locale locale) {
|
||||
TimeZoneDisplayKey(final TimeZone timeZone,
|
||||
final boolean daylight, int style, final Locale locale) {
|
||||
mTimeZone = timeZone;
|
||||
if (daylight) {
|
||||
style |= 0x80000000;
|
||||
|
@ -1244,7 +1244,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ abstract class FormatCache<F extends Format> {
|
|||
* @throws IllegalArgumentException if pattern is invalid
|
||||
* or <code>null</code>
|
||||
*/
|
||||
public F getInstance(String pattern, TimeZone timeZone, Locale locale) {
|
||||
public F getInstance(final String pattern, TimeZone timeZone, Locale locale) {
|
||||
if (pattern == null) {
|
||||
throw new NullPointerException("pattern must not be null");
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ abstract class FormatCache<F extends Format> {
|
|||
* @throws IllegalArgumentException if the Locale has no date/time
|
||||
* pattern defined
|
||||
*/
|
||||
public F getDateTimeInstance(Integer dateStyle, Integer timeStyle, TimeZone timeZone, Locale locale) {
|
||||
public F getDateTimeInstance(final Integer dateStyle, final Integer timeStyle, final TimeZone timeZone, Locale locale) {
|
||||
if (locale == null) {
|
||||
locale = Locale.getDefault();
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ abstract class FormatCache<F extends Format> {
|
|||
* @return a localized standard date/time format
|
||||
* @throws IllegalArgumentException if the Locale has no date/time pattern defined
|
||||
*/
|
||||
public static String getPatternForStyle(Integer dateStyle, Integer timeStyle, Locale locale) {
|
||||
public static String getPatternForStyle(final Integer dateStyle, final Integer timeStyle, final Locale locale) {
|
||||
MultipartKey key = new MultipartKey(dateStyle, timeStyle, locale);
|
||||
|
||||
String pattern = cDateTimeInstanceCache.get(key);
|
||||
|
@ -176,7 +176,7 @@ abstract class FormatCache<F extends Format> {
|
|||
* Constructs an instance of <code>MultipartKey</code> to hold the specified objects.
|
||||
* @param keys the set of objects that make up the key. Each key may be null.
|
||||
*/
|
||||
public MultipartKey(Object... keys) {
|
||||
public MultipartKey(final Object... keys) {
|
||||
this.keys = keys;
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ abstract class FormatCache<F extends Format> {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
// Eliminate the usual boilerplate because
|
||||
// this inner static class is only used in a generic ConcurrentHashMap
|
||||
// which will not compare against other Object types
|
||||
|
|
|
@ -54,7 +54,7 @@ public final class ImmutablePair<L, R> extends Pair<L, R> {
|
|||
* @param right the right element, may be null
|
||||
* @return a pair formed from the two parameters, not null
|
||||
*/
|
||||
public static <L, R> ImmutablePair<L, R> of(L left, R right) {
|
||||
public static <L, R> ImmutablePair<L, R> of(final L left, final R right) {
|
||||
return new ImmutablePair<L, R>(left, right);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public final class ImmutablePair<L, R> extends Pair<L, R> {
|
|||
* @param left the left value, may be null
|
||||
* @param right the right value, may be null
|
||||
*/
|
||||
public ImmutablePair(L left, R right) {
|
||||
public ImmutablePair(final L left, final R right) {
|
||||
super();
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
|
@ -97,7 +97,7 @@ public final class ImmutablePair<L, R> extends Pair<L, R> {
|
|||
* @throws UnsupportedOperationException as this operation is not supported
|
||||
*/
|
||||
@Override
|
||||
public R setValue(R value) {
|
||||
public R setValue(final R value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public final class ImmutableTriple<L, M, R> extends Triple<L, M, R> {
|
|||
* @param right the right element, may be null
|
||||
* @return a triple formed from the three parameters, not null
|
||||
*/
|
||||
public static <L, M, R> ImmutableTriple<L, M, R> of(L left, M middle, R right) {
|
||||
public static <L, M, R> ImmutableTriple<L, M, R> of(final L left, final M middle, final R right) {
|
||||
return new ImmutableTriple<L, M, R>(left, middle, right);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public final class ImmutableTriple<L, M, R> extends Triple<L, M, R> {
|
|||
* @param middle the middle value, may be null
|
||||
* @param right the right value, may be null
|
||||
*/
|
||||
public ImmutableTriple(L left, M middle, R right) {
|
||||
public ImmutableTriple(final L left, final M middle, final R right) {
|
||||
super();
|
||||
this.left = left;
|
||||
this.middle = middle;
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MutablePair<L, R> extends Pair<L, R> {
|
|||
* @param right the right element, may be null
|
||||
* @return a pair formed from the two parameters, not null
|
||||
*/
|
||||
public static <L, R> MutablePair<L, R> of(L left, R right) {
|
||||
public static <L, R> MutablePair<L, R> of(final L left, final R right) {
|
||||
return new MutablePair<L, R>(left, right);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class MutablePair<L, R> extends Pair<L, R> {
|
|||
* @param left the left value, may be null
|
||||
* @param right the right value, may be null
|
||||
*/
|
||||
public MutablePair(L left, R right) {
|
||||
public MutablePair(final L left, final R right) {
|
||||
super();
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
|
@ -86,7 +86,7 @@ public class MutablePair<L, R> extends Pair<L, R> {
|
|||
*
|
||||
* @param left the new value of the left element, may be null
|
||||
*/
|
||||
public void setLeft(L left) {
|
||||
public void setLeft(final L left) {
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ public class MutablePair<L, R> extends Pair<L, R> {
|
|||
*
|
||||
* @param right the new value of the right element, may be null
|
||||
*/
|
||||
public void setRight(R right) {
|
||||
public void setRight(final R right) {
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class MutablePair<L, R> extends Pair<L, R> {
|
|||
* @return the old value for the right element
|
||||
*/
|
||||
@Override
|
||||
public R setValue(R value) {
|
||||
public R setValue(final R value) {
|
||||
R result = getRight();
|
||||
setRight(value);
|
||||
return result;
|
||||
|
|
|
@ -53,7 +53,7 @@ public class MutableTriple<L, M, R> extends Triple<L, M, R> {
|
|||
* @param right the right element, may be null
|
||||
* @return a triple formed from the three parameters, not null
|
||||
*/
|
||||
public static <L, M, R> MutableTriple<L, M, R> of(L left, M middle, R right) {
|
||||
public static <L, M, R> MutableTriple<L, M, R> of(final L left, final M middle, final R right) {
|
||||
return new MutableTriple<L, M, R>(left, middle, right);
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class MutableTriple<L, M, R> extends Triple<L, M, R> {
|
|||
* @param middle the middle value, may be null
|
||||
* @param right the right value, may be null
|
||||
*/
|
||||
public MutableTriple(L left, M middle, R right) {
|
||||
public MutableTriple(final L left, final M middle, final R right) {
|
||||
super();
|
||||
this.left = left;
|
||||
this.middle = middle;
|
||||
|
@ -92,7 +92,7 @@ public class MutableTriple<L, M, R> extends Triple<L, M, R> {
|
|||
*
|
||||
* @param left the new value of the left element, may be null
|
||||
*/
|
||||
public void setLeft(L left) {
|
||||
public void setLeft(final L left) {
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class MutableTriple<L, M, R> extends Triple<L, M, R> {
|
|||
*
|
||||
* @param middle the new value of the middle element, may be null
|
||||
*/
|
||||
public void setMiddle(M middle) {
|
||||
public void setMiddle(final M middle) {
|
||||
this.middle = middle;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class MutableTriple<L, M, R> extends Triple<L, M, R> {
|
|||
*
|
||||
* @param right the new value of the right element, may be null
|
||||
*/
|
||||
public void setRight(R right) {
|
||||
public void setRight(final R right) {
|
||||
this.right = right;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
|
|||
* @param right the right element, may be null
|
||||
* @return a pair formed from the two parameters, not null
|
||||
*/
|
||||
public static <L, R> Pair<L, R> of(L left, R right) {
|
||||
public static <L, R> Pair<L, R> of(final L left, final R right) {
|
||||
return new ImmutablePair<L, R>(left, right);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
|
|||
* @return negative if this is less, zero if equal, positive if greater
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(Pair<L, R> other) {
|
||||
public int compareTo(final Pair<L, R> other) {
|
||||
return new CompareToBuilder().append(getLeft(), other.getLeft())
|
||||
.append(getRight(), other.getRight()).toComparison();
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
|
|||
* @return true if the elements of the pair are equal
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
|
|||
* @param format the format string, optionally containing {@code %1$s} and {@code %2$s}, not null
|
||||
* @return the formatted string, not null
|
||||
*/
|
||||
public String toString(String format) {
|
||||
public String toString(final String format) {
|
||||
return String.format(format, getLeft(), getRight());
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public abstract class Triple<L, M, R> implements Comparable<Triple<L, M, R>>, Se
|
|||
* @param right the right element, may be null
|
||||
* @return a triple formed from the three parameters, not null
|
||||
*/
|
||||
public static <L, M, R> Triple<L, M, R> of(L left, M middle, R right) {
|
||||
public static <L, M, R> Triple<L, M, R> of(final L left, final M middle, final R right) {
|
||||
return new ImmutableTriple<L, M, R>(left, middle, right);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public abstract class Triple<L, M, R> implements Comparable<Triple<L, M, R>>, Se
|
|||
* @return negative if this is less, zero if equal, positive if greater
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(Triple<L, M, R> other) {
|
||||
public int compareTo(final Triple<L, M, R> other) {
|
||||
return new CompareToBuilder().append(getLeft(), other.getLeft())
|
||||
.append(getMiddle(), other.getMiddle())
|
||||
.append(getRight(), other.getRight()).toComparison();
|
||||
|
@ -105,7 +105,7 @@ public abstract class Triple<L, M, R> implements Comparable<Triple<L, M, R>>, Se
|
|||
* @return true if the elements of the triple are equal
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public abstract class Triple<L, M, R> implements Comparable<Triple<L, M, R>>, Se
|
|||
* @param format the format string, optionally containing {@code %1$s}, {@code %2$s} and {@code %3$s}, not null
|
||||
* @return the formatted string, not null
|
||||
*/
|
||||
public String toString(String format) {
|
||||
public String toString(final String format) {
|
||||
return String.format(format, getLeft(), getMiddle(), getRight());
|
||||
}
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@ public class AnnotationUtilsTest {
|
|||
InvocationHandler generatedTestInvocationHandler = new InvocationHandler() {
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
|
||||
if ("equals".equals(method.getName()) && method.getParameterTypes().length == 1) {
|
||||
return Boolean.valueOf(proxy == args[0]);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ArrayUtilsTest {
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
private void assertIsEquals(Object array1, Object array2, Object array3) {
|
||||
private void assertIsEquals(final Object array1, final Object array2, final Object array3) {
|
||||
assertTrue(ArrayUtils.isEquals(array1, array1));
|
||||
assertTrue(ArrayUtils.isEquals(array2, array2));
|
||||
assertTrue(ArrayUtils.isEquals(array3, array3));
|
||||
|
@ -254,11 +254,11 @@ public class ArrayUtilsTest {
|
|||
return "bar";
|
||||
}
|
||||
@Override
|
||||
public Object setValue(Object value) {
|
||||
public Object setValue(final Object value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(final Object o) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.junit.Test;
|
|||
*/
|
||||
public class CharEncodingTest {
|
||||
|
||||
private void assertSupportedEncoding(String name) {
|
||||
private void assertSupportedEncoding(final String name) {
|
||||
assertTrue("Encoding should be supported: " + name, CharEncoding.isSupported(name));
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class CharEncodingTest {
|
|||
}
|
||||
}
|
||||
|
||||
void warn(String msg) {
|
||||
void warn(final String msg) {
|
||||
System.err.println(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class CharUtilsPerfRun {
|
|||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(final String[] args) {
|
||||
new CharUtilsPerfRun().run();
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public class CharUtilsPerfRun {
|
|||
this.printlnTotal("run_CharSet", start);
|
||||
}
|
||||
|
||||
private int run_CharSet(int loopCount) {
|
||||
private int run_CharSet(final int loopCount) {
|
||||
int t = 0;
|
||||
for (int i = 0; i < loopCount; i++) {
|
||||
for (char ch : CHAR_SAMPLES) {
|
||||
|
@ -133,7 +133,7 @@ public class CharUtilsPerfRun {
|
|||
return t;
|
||||
}
|
||||
|
||||
private int run_CharUtils_isAsciiNumeric(int loopCount) {
|
||||
private int run_CharUtils_isAsciiNumeric(final int loopCount) {
|
||||
int t = 0;
|
||||
for (int i = 0; i < loopCount; i++) {
|
||||
for (char ch : CHAR_SAMPLES) {
|
||||
|
@ -144,7 +144,7 @@ public class CharUtilsPerfRun {
|
|||
return t;
|
||||
}
|
||||
|
||||
private int run_inlined_CharUtils_isAsciiNumeric(int loopCount) {
|
||||
private int run_inlined_CharUtils_isAsciiNumeric(final int loopCount) {
|
||||
int t = 0;
|
||||
for (int i = 0; i < loopCount; i++) {
|
||||
for (char ch : CHAR_SAMPLES) {
|
||||
|
@ -155,7 +155,7 @@ public class CharUtilsPerfRun {
|
|||
return t;
|
||||
}
|
||||
|
||||
private void printlnTotal(String prefix, long start) {
|
||||
private void printlnTotal(final String prefix, final long start) {
|
||||
long total = System.currentTimeMillis() - start;
|
||||
System.out.println(prefix + ": " + NumberFormat.getInstance().format(total) + " milliseconds.");
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue