[Simple-support] Fwd: Allowing polymorphic collections serialization to match original definitions
Brought to you by:
niallg
|
From: Quirino Z. <qu...@la...> - 2009-03-28 10:36:16
|
---------- Forwarded message ----------
From: Quirino Zagarese <the...@gm...>
Date: 2009/3/28
Subject: Allowing polymorphic collections serialization to match original
definitions
To: sim...@li...
Hi,
I'm trying to serialize a collection that may contain different types.
Now, simple resolves polymorphism using the class attribute.
I would be great if I could do something like this:
@Root
public class AZ{
@ElementList(inline=true,useroot=true)
private Collection<Letter> elements;
.....
public az(){
elements = new ArrayList();
// A and B implement Letter
elements.add(new A());
elements.add(new B());
.....
}
}
and obtain:
<AZ>
<A/>
<B/>
.....
</AZ>
instead of:
<AZ>
<Letter class="A"/>
<Letter class="B"/>
....
</AZ>
This could be very useful for all the tools that have to generate XUL like
XML.
In those cases you have an element that may contain from 0 to N elements and
you don't know a priori the type of each element(and of course you have to
serialize it with its name, not with the <interfacename
class="realclassname"/> technique).
Any thoughts?
Regards
--
Quirino Zagarese
LaszloItalia Founder (www.laszloitalia.org)
Software Development Manager - Galilaeus s.r.l.
--
Quirino Zagarese
LaszloItalia Founder (www.laszloitalia.org)
Software Development Manager - Galilaeus s.r.l.
|