[Simple-support] Customizing ElementMap serializer/deserializer
Brought to you by:
niallg
|
From: Kin O. L. <ko...@ap...> - 2008-12-11 05:19:22
|
Hello,
I'm new to Simple and is currently evaluating it for use in a project.
I have an existing XML and would like to deserialize it into a map
(Map<String,Object>):
<properties>
<entry>
<key>boolean-value</key>
<value>
<boolean>true</boolean>
</value>
</entry>
<entry>
<key>string-value</key>
<value>
<string>hello world</string>
</value>
</entry>
<entry>
<key>intvalue</key>
<value>
<int>42</int>
</value>
</entry>
</properties>
The value type can be one of the following:
<boolean>?</boolean>
<byte>?</byte>
<double>?</double>
<float>?</float>
<int>?</int>
<long>?</long>
<short>?</short>
<dateTime>?</dateTime>
<string>?</string>
So far, the closest I've been able to get to is this:
<properties class="java.util.HashMap">
<entry>
<key>boolean-value</key>
<value class="java.lang.Boolean">true</value>
</entry>
<entry>
<key>string-value</key>
<value class="java.lang.String">hello world</value>
</entry>
<entry>
<key>intvalue</key>
<value class="java.lang.Integer">42</value>
</entry>
</properties>
@ElementMap (inline=false, key="key", value="value")
private Map<String, Object> properties;
Is it possible to override default map deserializer/serializer to handle
the input XML which I have?
Thanks!
|