Re: [Simple-support] Serializing List<object>
Brought to you by:
niallg
|
From: hatchetman82 <hat...@gm...> - 2011-03-07 06:30:12
|
this was asked on the list a couple of days back.
the response was that something along the lines of:
@VariantList({
@ElementList(entry="cleanDir", type=CleanDirCommand.class),
@ElementList(entry="copy", type=CopyCommand.class)
})
private List<Command> commands;
is coming to simple in the next couple of weeks.
On Sun, Mar 6, 2011 at 22:40, Philipp Feigl
<phi...@go...> wrote:
> 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
> ------------------------------------------------------------------------------
> What You Don't Know About Data Connectivity CAN Hurt You
> This paper provides an overview of data connectivity, details
> its effect on application quality, and explores various alternative
> solutions. http://p.sf.net/sfu/progress-d2d
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
|