You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "lkj41110 (GitHub)" <gi...@apache.org> on 2019/12/11 03:22:13 UTC
[GitHub] [dubbo] lkj41110 opened issue #5453: The field name is worng
when generic call.
### Steps to reproduce this issue
1. 我定义的返回类型是
```
public class Person implements Serializable {
private static final long serialVersionUID = 1L;
private String ABC;
public Person() {}
public Person(String name, int age) {
}
public Person(String name, int age,String ABC) {
this.ABC = ABC;
}
public String getABC() {
return ABC;
}
public void setABC(String ABC) {
this.ABC = ABC;
}
}
```
2. 在泛化调用后,会通过PojoUtils转化为Map。但是转化后ABC的首字母会变为aBC
```
PojoUtils.generalize(appResponse.getValue());
## 最终是通过这个方法转换了
map.put(ReflectUtils.getPropertyNameFromBeanReadMethod(method),generalize(method.invoke(pojo), history));
```
3. getPropertyNameFromBeanReadMethod里是通过解析get方法
```
public static String getPropertyNameFromBeanReadMethod(Method method) {
if (isBeanPropertyReadMethod(method)) {
if (method.getName().startsWith("get")) {
return method.getName().substring(3, 4).toLowerCase()
+ method.getName().substring(4);
}
if (method.getName().startsWith("is")) {
return method.getName().substring(2, 3).toLowerCase()
+ method.getName().substring(3);
}
}
return null;
}
```
### Expected Result
返回结果中map中key为`ABC`
### Actual Result
返回结果中map中key为`aBC`
不知道这算不算一个bug
[ Full content available at: https://github.com/apache/dubbo/issues/5453 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] chickenlj closed issue #5453: The field name is
worng when generic call.
Posted by "chickenlj (GitHub)" <gi...@apache.org>.
[ issue closed by chickenlj ]
[ Full content available at: https://github.com/apache/dubbo/issues/5453 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] chickenlj commented on issue #5453: The field name
is worng when generic call.
Posted by "chickenlj (GitHub)" <gi...@apache.org>.
抱歉,目前暂无计划对这部分代码作改动,请尽量遵循 Java Bean 定义规范
[ Full content available at: https://github.com/apache/dubbo/issues/5453 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org