Re: [Simple-support] Serialization of nested lists, arrays
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2012-04-26 22:18:20
|
You can create an object that contains a list and make the list inline like so.
@ElementListList<Blah>list;
class Blah { @ElementList(inline=true) List<BigDecimal> inline;}
--- On Thu, 26/4/12, Bernhard Groll <ber...@tu...> wrote:
From: Bernhard Groll <ber...@tu...>
Subject: [Simple-support] Serialization of nested lists, arrays
To: "sim...@li..." <sim...@li...>
Received: Thursday, 26 April, 2012, 8:10 AM
Hello everybody,
I have a problem with serializing lists containing arrays, and I hope
that one of you can help me.
I have the following code:
@ElementList(entry="reading")
private List<BigDecimal[]> readings;
This is serialized as
<readings>
<reading length="2">42.5, 23.9</reading>
<reading length="2">5.7, 8.3</reading>
</readings>
But what I want is something like this (I don’t actually need the
length attribute):
<readings>
<reading length="2">
<value>42.5</value>
<value>23.9</value>
</reading>
<reading length="2">
<value>5.7</value>
<value>8.3</value>
</reading>
</readings>
I know that I can annotate a single array to get the inner
representation I want.
@ElementArray(entry = "value")
private BigDecimal[] reading;
<reading length="2">
<value>42.5</value>
<value>23.9</value>
</reading>
What I can’t figure out is how to combine these list and array
annotations or otherwise get the desired result.
I’d appreciate any advice.
Best regards,
Bernhard
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|