[Simple-support] Map serialization and deserialization
Brought to you by:
niallg
|
From: Nuno F. <nfa...@is...> - 2007-08-04 18:03:50
|
Hello,
I think Simple framework was an excelent idea. For some years now I have
been trying to find such an easy way to work with XML in Java, and
finally, here it is.
One thing that is missing tough, is the possibility of directly
serializing and deserializing java.util.Map implementing classes
(HashMap, TreeMap, etc), the same way you do with java.util.Collection
classes (ArrayList, HashSet...). There is the Dictionary class, but it's
to limited to my needs, and not exactly what I'm searching for. It is
also possible to use two collection structures and then perform the
necessary binding with Commit, but it's missing the point.
In my case, I have need several complex Map structures, like this for
example:
HashMap<AISSubstance, Double> supSubCon;
The class AISSubstance is annotated with @Root, and several fields are
serializable (with @Element or @Attribute); the Double class is
serialized via Transform. The XML could look something like:
<supSubCon>
<AISSubstance name="whatever">
<BitString>001010001000101</BitString>
<kDif>0.123</kDif>
<kDeg>-0.000234</kDeg>
</AISSubstance>
<double>
1295.1254354
</double>
<AISSubstance name="whatever2">
<BitString>11001010001111101</BitString>
<kDif>0.8231</kDif>
<kDeg>-0.0452486</kDeg>
</AISSubstance>
<double>
99.4336547
</double>
</supSubCon>
I think this could be a very helpful addition to your (already great)
project.
Nuno
|