mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 17:48:25 +08:00
修改getPropertySimpleType方法实现,不再使用Class.forName(str), 防止出现找不到类的问题。
This commit is contained in:
parent
91e503ba74
commit
3247658ded
@ -99,17 +99,13 @@ public class Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPropertySimpleType() {
|
public String getPropertySimpleType() {
|
||||||
try {
|
if (columnConfig.getPropertyType() != null) {
|
||||||
if (columnConfig.getPropertyType() != null) {
|
if (!columnConfig.getPropertyType().contains(".")) {
|
||||||
if (!columnConfig.getPropertyType().contains(".")) {
|
return columnConfig.getPropertyType();
|
||||||
return columnConfig.getPropertyType();
|
|
||||||
}
|
|
||||||
return Class.forName(columnConfig.getPropertyType()).getSimpleName();
|
|
||||||
} else {
|
|
||||||
return propertyType.substring(propertyType.lastIndexOf(".") + 1);
|
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
return StringUtil.substringAfterLast(columnConfig.getPropertyType(), ".");
|
||||||
throw new RuntimeException(e);
|
} else {
|
||||||
|
return StringUtil.substringAfterLast(propertyType, ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -287,5 +287,15 @@ public class StringUtil {
|
|||||||
return string != null ? string.trim() : null;
|
return string != null ? string.trim() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String substringAfterLast(String text, String str) {
|
||||||
|
if (text == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (str == null) {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
return text.substring(text.lastIndexOf(str) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user