当前位置 : 主页 > 编程语言 > java >

XStream应用实例

来源:互联网 收集:自由互联 发布时间:2022-09-02
XStream xStream = new XStream () { @Override protected MapperWrapper wrapMapper ( MapperWrapper next ){ return new MapperWrapper ( next ) { @Override public boolean shouldSerializeMember ( Class definedIn , String fieldName ){ if ( definedI


XStream xStream = new XStream() {
@Override
protected MapperWrapper wrapMapper(MapperWrapper next){
return new MapperWrapper(next) {
@Override
public boolean shouldSerializeMember(Class definedIn, String fieldName){
if (definedIn == Object.class){
try {
return this.realClass(fieldName) != null;
} catch (Exception e){
return false;
}
} else {
return super.shouldSerializeMember(definedIn, fieldName);
}
}
};
}};
XStream.setupDefaultSecurity(xStream);
xStream.allowTypesByRegExp(new String[] { ".*" });
xStream.alias("Body",CmlabsReturn.ReportListResult.class);
上一篇:数据按半小时统计显示
下一篇:没有了
网友评论