提交 6653e34a authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Extract x.getClass() to local variable in DataType.convertToValue1()

上级 0875ef24
...@@ -1127,7 +1127,9 @@ public class DataType { ...@@ -1127,7 +1127,9 @@ public class DataType {
return ValueResultSet.getCopy((ResultSet) x, Integer.MAX_VALUE); return ValueResultSet.getCopy((ResultSet) x, Integer.MAX_VALUE);
} else if (x instanceof UUID) { } else if (x instanceof UUID) {
return ValueUuid.get((UUID) x); return ValueUuid.get((UUID) x);
} else if (x instanceof Object[]) { }
Class<?> clazz = x.getClass();
if (x instanceof Object[]) {
// (a.getClass().isArray()); // (a.getClass().isArray());
// (a.getClass().getComponentType().isPrimitive()); // (a.getClass().getComponentType().isPrimitive());
Object[] o = (Object[]) x; Object[] o = (Object[]) x;
...@@ -1136,20 +1138,20 @@ public class DataType { ...@@ -1136,20 +1138,20 @@ public class DataType {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
v[i] = convertToValue(session, o[i], type); v[i] = convertToValue(session, o[i], type);
} }
return ValueArray.get(x.getClass().getComponentType(), v); return ValueArray.get(clazz.getComponentType(), v);
} else if (x instanceof Character) { } else if (x instanceof Character) {
return ValueStringFixed.get(((Character) x).toString()); return ValueStringFixed.get(((Character) x).toString());
} else if (isGeometry(x)) { } else if (isGeometry(x)) {
return ValueGeometry.getFromGeometry(x); return ValueGeometry.getFromGeometry(x);
} else if (x.getClass() == LocalDateTimeUtils.LOCAL_DATE) { } else if (clazz == LocalDateTimeUtils.LOCAL_DATE) {
return LocalDateTimeUtils.localDateToDateValue(x); return LocalDateTimeUtils.localDateToDateValue(x);
} else if (x.getClass() == LocalDateTimeUtils.LOCAL_TIME) { } else if (clazz == LocalDateTimeUtils.LOCAL_TIME) {
return LocalDateTimeUtils.localTimeToTimeValue(x); return LocalDateTimeUtils.localTimeToTimeValue(x);
} else if (x.getClass() == LocalDateTimeUtils.LOCAL_DATE_TIME) { } else if (clazz == LocalDateTimeUtils.LOCAL_DATE_TIME) {
return LocalDateTimeUtils.localDateTimeToValue(x); return LocalDateTimeUtils.localDateTimeToValue(x);
} else if (x.getClass() == LocalDateTimeUtils.INSTANT) { } else if (clazz == LocalDateTimeUtils.INSTANT) {
return LocalDateTimeUtils.instantToValue(x); return LocalDateTimeUtils.instantToValue(x);
} else if (x.getClass() == LocalDateTimeUtils.OFFSET_DATE_TIME) { } else if (clazz == LocalDateTimeUtils.OFFSET_DATE_TIME) {
return LocalDateTimeUtils.offsetDateTimeToValue(x); return LocalDateTimeUtils.offsetDateTimeToValue(x);
} else if (x instanceof TimestampWithTimeZone) { } else if (x instanceof TimestampWithTimeZone) {
return ValueTimestampTimeZone.get((TimestampWithTimeZone) x); return ValueTimestampTimeZone.get((TimestampWithTimeZone) x);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论