private String underscoreName(String name) {
StringBuilder result = new StringBuilder();
if (name != null && name.length() > 0) {
result.append(name.substring(0, 1).toLowerCase());
for (int i = 1; i < name.length(); i++) {
String s = name.substring(i, i + 1);
if (s.equals(s.toUpperCase())) {
result.append("_");
result.append(s.toLowerCase());
}
else {
result.append(s);
}
}
}
return result.toString();
}
会按规则加下划线( _ ),然后根据 hashmap 进行匹配 ,如果取到了key ,,则把db中的值放到此列中
spring jpa 解析 @Column 时转化 原码
猜你喜欢
转载自jiachenmianyu.iteye.com/blog/2253760
今日推荐
周排行