|
|
@@ -179,7 +179,7 @@ public class PostgreUtils {
|
|
|
final String[] strings = vector.split(PostgreConstants.DEFAULT_ARRAY_DELIMITER);
|
|
|
final long[] ids = new long[strings.length];
|
|
|
for (int i = 0; i < strings.length; i++) {
|
|
|
- ids[i] = Long.parseLong(strings[i]);
|
|
|
+ ids[i] = CommonUtils.toLong(strings[i]);
|
|
|
}
|
|
|
return ids;
|
|
|
} else if (pgVector instanceof long[]) {
|
|
|
@@ -223,31 +223,29 @@ public class PostgreUtils {
|
|
|
if (pgVector == null) {
|
|
|
return null;
|
|
|
}
|
|
|
- if (pgVector instanceof String) {
|
|
|
- final String vector = (String) pgVector;
|
|
|
+ if (pgVector instanceof String vector) {
|
|
|
if (vector.isEmpty()) {
|
|
|
return null;
|
|
|
}
|
|
|
final String[] strings = vector.split(PostgreConstants.DEFAULT_ARRAY_DELIMITER);
|
|
|
final int[] ids = new int[strings.length];
|
|
|
for (int i = 0; i < strings.length; i++) {
|
|
|
- ids[i] = Integer.parseInt(strings[i]);
|
|
|
+ ids[i] = CommonUtils.toInt(strings[i]);
|
|
|
}
|
|
|
return ids;
|
|
|
- } else if (pgVector instanceof int[]) {
|
|
|
- return (int[]) pgVector;
|
|
|
- } else if (pgVector instanceof Integer[]) {
|
|
|
- Integer[] objVector = (Integer[]) pgVector;
|
|
|
+ } else if (pgVector instanceof int[] intVector) {
|
|
|
+ return intVector;
|
|
|
+ } else if (pgVector instanceof Integer[] objVector) {
|
|
|
int[] result = new int[objVector.length];
|
|
|
for (int i = 0; i < objVector.length; i++) {
|
|
|
result[i] = objVector[i];
|
|
|
}
|
|
|
return result;
|
|
|
- } else if (pgVector instanceof Number) {
|
|
|
- return new int[]{((Number) pgVector).intValue()};
|
|
|
- } else if (pgVector instanceof java.sql.Array) {
|
|
|
+ } else if (pgVector instanceof Number number) {
|
|
|
+ return new int[]{number.intValue()};
|
|
|
+ } else if (pgVector instanceof java.sql.Array pgArray) {
|
|
|
try {
|
|
|
- Object array = ((java.sql.Array) pgVector).getArray();
|
|
|
+ Object array = pgArray.getArray();
|
|
|
if (array == null) {
|
|
|
return null;
|
|
|
}
|