【发布时间】:2014-03-26 08:29:43
【问题描述】:
我有这样的课程:
class A{
//pojo
}
class B extends {
// pojo
}
class C{
@XStreamImplicit( itemFieldName="A")
private ArrayList<A> aList = null;
}
提交的C类aList包含一种对象类型A.class和一种类型B.class。
我可以将类序列化和反序列化到这个xml:
<c>
<aList>
<a/>
<a/>
</aList>
</c>
但我希望 xml 文件看起来像这样:
<c>
<aList>
<a/>
<b/>
</aList>
</c>
有可能吗?我该怎么做?
【问题讨论】: