net.sf.json.JSONObject net.sf.json.JSONObject.toBean(JSONObject.java:431) - Tried to assign property OutStationNo:java.lang.Integer to bean of class com.newsoft.roadService.po.FeeVO
net.sf.json.JSONObject net.sf.json.JSONObject.toBean(JSONObject.java:431) - Tried to assign property VehClassNo:java.lang.Integer to bean of class com.newsoft.roadService.po.FeeVO
net.sf.json.JSONObject net.sf.json.JSONObject.toBean(JSONObject.java:431) - Tried to assign property WayTypeNo:java.lang.Integer to bean of class com.newsoft.roadService.po.FeeVO
今天偶然在调试程序的时候,偶然发现这个警告,同时还发现当json转换为bean对象时,发现上述报警告的这些值在对象中全部为空。
看了源码也找不到问题所在,后面发现与该对象中其他值唯一不同的地方就是开头字母大写了。(接口文档中规定第一个字母大写,故出现此种情况)
解决方案:
在研究该问题时,发现有两种解决方案
1、将该bean对象的首字母全部改为小写。
2、将该bean对象的首字母大写的后面几个单词改为大写(开头算起,连续的大写字母数量>1)