[Simple-support] Serializing List<object>
Brought to you by:
niallg
|
From: Philipp F. <phi...@go...> - 2011-03-06 20:40:34
|
Hi,
I have an object of type List<object>. The list contains 3 known differnt
types of classes. While I understand that List<object> is not ideal, I
cannot change this, as it is auto-generated code (created with JAXB and than
transformed into Simple readable code)
Serializing it with the default rules would serialize it as <object
class="...."> which is not what I want. I'd like to have it serialized with
the respective class types name.
JAXB does it the following way:
@XmlElements({
@XmlElement(name = "Layout", type =
Order.LineItems.Layout.class),
@XmlElement(name = "Fee", type = Order.LineItems.Fee.class),
@XmlElement(name = "Print", type = Order.LineItems.Print.class)
})
protected List<Object> feeOrPrintOrLayout;
The result should look something like
<parent>
<Layout ..>
<Print ...>
<Print ...>
<Print ...>
<Print ...>
<Fee ....>
</parent>
Is there any way to achieve the same in Simple?
Thanks for any suggestions,
Philipp
|