|
|
@ -28,7 +28,7 @@ public abstract class ObjectUtils {
|
|
|
|
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class... declaredExceptions) {
|
|
|
|
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class... declaredExceptions) {
|
|
|
|
if(!isCheckedException(ex)) {
|
|
|
|
if(!isCheckedException(ex)) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
if(declaredExceptions != null) {
|
|
|
|
if(declaredExceptions != null) {
|
|
|
|
Class[] var2 = declaredExceptions;
|
|
|
|
Class[] var2 = declaredExceptions;
|
|
|
|
int var3 = declaredExceptions.length;
|
|
|
|
int var3 = declaredExceptions.length;
|
|
|
@ -43,7 +43,6 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean isArray(Object obj) {
|
|
|
|
public static boolean isArray(Object obj) {
|
|
|
|
return obj != null && obj.getClass().isArray();
|
|
|
|
return obj != null && obj.getClass().isArray();
|
|
|
@ -56,7 +55,7 @@ public abstract class ObjectUtils {
|
|
|
|
public static boolean containsElement(Object[] array, Object element) {
|
|
|
|
public static boolean containsElement(Object[] array, Object element) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
Object[] var2 = array;
|
|
|
|
Object[] var2 = array;
|
|
|
|
int var3 = array.length;
|
|
|
|
int var3 = array.length;
|
|
|
|
|
|
|
|
|
|
|
@ -69,7 +68,6 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean containsConstant(Enum<?>[] enumValues, String constant) {
|
|
|
|
public static boolean containsConstant(Enum<?>[] enumValues, String constant) {
|
|
|
|
return containsConstant(enumValues, constant, false);
|
|
|
|
return containsConstant(enumValues, constant, false);
|
|
|
@ -179,7 +177,7 @@ public abstract class ObjectUtils {
|
|
|
|
public static int nullSafeHashCode(Object obj) {
|
|
|
|
public static int nullSafeHashCode(Object obj) {
|
|
|
|
if(obj == null) {
|
|
|
|
if(obj == null) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
if(obj.getClass().isArray()) {
|
|
|
|
if(obj.getClass().isArray()) {
|
|
|
|
if(obj instanceof Object[]) {
|
|
|
|
if(obj instanceof Object[]) {
|
|
|
|
return nullSafeHashCode((Object[])((Object[])obj));
|
|
|
|
return nullSafeHashCode((Object[])((Object[])obj));
|
|
|
@ -220,12 +218,11 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return obj.hashCode();
|
|
|
|
return obj.hashCode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int nullSafeHashCode(Object[] array) {
|
|
|
|
public static int nullSafeHashCode(Object[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int hash = 7;
|
|
|
|
int hash = 7;
|
|
|
|
Object[] var2 = array;
|
|
|
|
Object[] var2 = array;
|
|
|
|
int var3 = array.length;
|
|
|
|
int var3 = array.length;
|
|
|
@ -237,12 +234,11 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int nullSafeHashCode(boolean[] array) {
|
|
|
|
public static int nullSafeHashCode(boolean[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int hash = 7;
|
|
|
|
int hash = 7;
|
|
|
|
boolean[] var2 = array;
|
|
|
|
boolean[] var2 = array;
|
|
|
|
int var3 = array.length;
|
|
|
|
int var3 = array.length;
|
|
|
@ -254,12 +250,11 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int nullSafeHashCode(byte[] array) {
|
|
|
|
public static int nullSafeHashCode(byte[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int hash = 7;
|
|
|
|
int hash = 7;
|
|
|
|
byte[] var2 = array;
|
|
|
|
byte[] var2 = array;
|
|
|
|
int var3 = array.length;
|
|
|
|
int var3 = array.length;
|
|
|
@ -271,12 +266,11 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int nullSafeHashCode(char[] array) {
|
|
|
|
public static int nullSafeHashCode(char[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int hash = 7;
|
|
|
|
int hash = 7;
|
|
|
|
char[] var2 = array;
|
|
|
|
char[] var2 = array;
|
|
|
|
int var3 = array.length;
|
|
|
|
int var3 = array.length;
|
|
|
@ -288,12 +282,11 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int nullSafeHashCode(double[] array) {
|
|
|
|
public static int nullSafeHashCode(double[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int hash = 7;
|
|
|
|
int hash = 7;
|
|
|
|
double[] var2 = array;
|
|
|
|
double[] var2 = array;
|
|
|
|
int var3 = array.length;
|
|
|
|
int var3 = array.length;
|
|
|
@ -305,12 +298,11 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int nullSafeHashCode(float[] array) {
|
|
|
|
public static int nullSafeHashCode(float[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int hash = 7;
|
|
|
|
int hash = 7;
|
|
|
|
float[] var2 = array;
|
|
|
|
float[] var2 = array;
|
|
|
|
int var3 = array.length;
|
|
|
|
int var3 = array.length;
|
|
|
@ -322,12 +314,11 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int nullSafeHashCode(int[] array) {
|
|
|
|
public static int nullSafeHashCode(int[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int hash = 7;
|
|
|
|
int hash = 7;
|
|
|
|
int[] var2 = array;
|
|
|
|
int[] var2 = array;
|
|
|
|
int var3 = array.length;
|
|
|
|
int var3 = array.length;
|
|
|
@ -339,12 +330,11 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int nullSafeHashCode(long[] array) {
|
|
|
|
public static int nullSafeHashCode(long[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int hash = 7;
|
|
|
|
int hash = 7;
|
|
|
|
long[] var2 = array;
|
|
|
|
long[] var2 = array;
|
|
|
|
int var3 = array.length;
|
|
|
|
int var3 = array.length;
|
|
|
@ -356,12 +346,11 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int nullSafeHashCode(short[] array) {
|
|
|
|
public static int nullSafeHashCode(short[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int hash = 7;
|
|
|
|
int hash = 7;
|
|
|
|
short[] var2 = array;
|
|
|
|
short[] var2 = array;
|
|
|
|
int var3 = array.length;
|
|
|
|
int var3 = array.length;
|
|
|
@ -373,7 +362,6 @@ public abstract class ObjectUtils {
|
|
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int hashCode(boolean bool) {
|
|
|
|
public static int hashCode(boolean bool) {
|
|
|
|
return bool?1231:1237;
|
|
|
|
return bool?1231:1237;
|
|
|
@ -439,7 +427,7 @@ public abstract class ObjectUtils {
|
|
|
|
public static String nullSafeToString(Object[] array) {
|
|
|
|
public static String nullSafeToString(Object[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return "null";
|
|
|
|
return "null";
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int length = array.length;
|
|
|
|
int length = array.length;
|
|
|
|
if(length == 0) {
|
|
|
|
if(length == 0) {
|
|
|
|
return "{}";
|
|
|
|
return "{}";
|
|
|
@ -458,12 +446,11 @@ public abstract class ObjectUtils {
|
|
|
|
return sb.toString();
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String nullSafeToString(boolean[] array) {
|
|
|
|
public static String nullSafeToString(boolean[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return "null";
|
|
|
|
return "null";
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int length = array.length;
|
|
|
|
int length = array.length;
|
|
|
|
if(length == 0) {
|
|
|
|
if(length == 0) {
|
|
|
|
return "{}";
|
|
|
|
return "{}";
|
|
|
@ -482,12 +469,11 @@ public abstract class ObjectUtils {
|
|
|
|
return sb.toString();
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String nullSafeToString(byte[] array) {
|
|
|
|
public static String nullSafeToString(byte[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return "null";
|
|
|
|
return "null";
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int length = array.length;
|
|
|
|
int length = array.length;
|
|
|
|
if(length == 0) {
|
|
|
|
if(length == 0) {
|
|
|
|
return "{}";
|
|
|
|
return "{}";
|
|
|
@ -506,12 +492,11 @@ public abstract class ObjectUtils {
|
|
|
|
return sb.toString();
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String nullSafeToString(char[] array) {
|
|
|
|
public static String nullSafeToString(char[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return "null";
|
|
|
|
return "null";
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int length = array.length;
|
|
|
|
int length = array.length;
|
|
|
|
if(length == 0) {
|
|
|
|
if(length == 0) {
|
|
|
|
return "{}";
|
|
|
|
return "{}";
|
|
|
@ -530,12 +515,11 @@ public abstract class ObjectUtils {
|
|
|
|
return sb.toString();
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String nullSafeToString(double[] array) {
|
|
|
|
public static String nullSafeToString(double[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return "null";
|
|
|
|
return "null";
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int length = array.length;
|
|
|
|
int length = array.length;
|
|
|
|
if(length == 0) {
|
|
|
|
if(length == 0) {
|
|
|
|
return "{}";
|
|
|
|
return "{}";
|
|
|
@ -554,12 +538,11 @@ public abstract class ObjectUtils {
|
|
|
|
return sb.toString();
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String nullSafeToString(float[] array) {
|
|
|
|
public static String nullSafeToString(float[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return "null";
|
|
|
|
return "null";
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int length = array.length;
|
|
|
|
int length = array.length;
|
|
|
|
if(length == 0) {
|
|
|
|
if(length == 0) {
|
|
|
|
return "{}";
|
|
|
|
return "{}";
|
|
|
@ -578,12 +561,11 @@ public abstract class ObjectUtils {
|
|
|
|
return sb.toString();
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String nullSafeToString(int[] array) {
|
|
|
|
public static String nullSafeToString(int[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return "null";
|
|
|
|
return "null";
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int length = array.length;
|
|
|
|
int length = array.length;
|
|
|
|
if(length == 0) {
|
|
|
|
if(length == 0) {
|
|
|
|
return "{}";
|
|
|
|
return "{}";
|
|
|
@ -602,12 +584,11 @@ public abstract class ObjectUtils {
|
|
|
|
return sb.toString();
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String nullSafeToString(long[] array) {
|
|
|
|
public static String nullSafeToString(long[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return "null";
|
|
|
|
return "null";
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int length = array.length;
|
|
|
|
int length = array.length;
|
|
|
|
if(length == 0) {
|
|
|
|
if(length == 0) {
|
|
|
|
return "{}";
|
|
|
|
return "{}";
|
|
|
@ -626,12 +607,11 @@ public abstract class ObjectUtils {
|
|
|
|
return sb.toString();
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String nullSafeToString(short[] array) {
|
|
|
|
public static String nullSafeToString(short[] array) {
|
|
|
|
if(array == null) {
|
|
|
|
if(array == null) {
|
|
|
|
return "null";
|
|
|
|
return "null";
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
int length = array.length;
|
|
|
|
int length = array.length;
|
|
|
|
if(length == 0) {
|
|
|
|
if(length == 0) {
|
|
|
|
return "{}";
|
|
|
|
return "{}";
|
|
|
@ -651,4 +631,3 @@ public abstract class ObjectUtils {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|