XStream xml 转java出错

唐代de豆腐 发布于 2016/08/22 22:13
阅读 388
收藏 0

为什么这种数据还转不了。操大爷

"<Result>"+"<totalCount>0</totalCount>"+"</Result>";

对象:

@XStreamAlias("Result")

public class Result implements Serializable {

private static final long serialVersionUID = 5649683447795092580L;

private int totalCount;


public int getTotalCount() {

return totalCount;

}


public void setTotalCount(int totalCount) {

this.totalCount = totalCount;

}


}

代码

XStream xs = new XStream(new StaxDriver());

xs.setMode(XStream.NO_REFERENCES);

xs.autodetectAnnotations(true); 

错误:

<?xml version="1.0" encoding="UTF-8"?><Result><totalCount>0</totalCount></Result>

com.thoughtworks.xstream.mapper.CannotResolveClassException: Result

at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:81)

加载中
返回顶部
顶部