Re: [Simple-support] populating ElementMap
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2011-09-22 10:25:01
|
Its false for a reason only <exported>true</exported> is true. <exported> true</exported> is false, because it evaluates to " true". Your options are to a) write a Transform to parse boolean values or b) change your XML.
--- On Wed, 21/9/11, bubbleguuum <bub...@fr...> wrote:
> From: bubbleguuum <bub...@fr...>
> Subject: [Simple-support] populating ElementMap
> To: sim...@li...
> Received: Wednesday, 21 September, 2011, 7:15 AM
> Give then following XML:
>
> <devices>
> <device udn="1">
> <exported>
>
> true
> </exported>
> </device>
> <device udn="2">
> <exported>
>
> false
> </exported>
> </device>
> </devices>
>
>
> I want to populate a Map whose values are of type Device
> with:
>
> @Root
> public static class Device {
> @Element(required = false)
> private boolean exported;
>
> public Device() {
> }
> }
>
>
> The map is declared as:
>
> @ElementMap(entry="device", key="udn", attribute=true)
> private Map<String, Device> devices;
>
>
>
> The result is Map containing 2 Device with correct key, but
> the devices
> were not parsed (ie for the first one , exported is
> false).
>
>
> I must be missing something obvious to achieve this ?
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT
> infrastructure contains a
> definitive record of customers, application performance,
> security
> threats, fraudulent activity and more. Splunk takes this
> data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|