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)