JSONObject中的⼀个⼩bug
JSONObject中的⼀个⼩bug
1.
package com.del;
import java.util.Date;
public class Accreditation {
private String aAdvice;
//省去getter和setter
}
JSONObject acc = new JSONObject();
acc.put("aAdvice","123");
Accreditation accreditation = (Accreditation) Bean(acc, Accreditation.class);
System.out.AAdvice());//输出null,并出现WARN net.sf.json.JSONObject:431 - Tried to assign property aSignture:java.lang.String to bean of class com.del.Accreditation
2.
package com.del;
import java.util.Date;
public class Accreditation {
private String aadvice;
//省去getter和setter
object to
}
JSONObject acc = new JSONObject();
acc.put("aadvice","123");
Accreditation accreditation = (Accreditation) Bean(acc, Accreditation.class);
System.out.Aadvice());//输出123
这两个之间的差别仅仅在于Accreditation中的属性⼀个是aAdvice,⼀个是aadvice。
所以建议toBean中的bean中的属性名的第⼆个字母不要⼤写

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。