[Simple-support] deserializing a list of subclasses
Brought to you by:
niallg
|
From: Carl H. S. <ch...@da...> - 2008-12-24 10:21:02
|
Is it possible to specify how elements map to classes in the code,
rather than in the xml using the class attribute? Here's an example of
what I mean:
Suppose I have classes as follows:
package a.b.c.d;
class Component {}
class TextField extends Component {}
class TextArea extends Component {}
class Choice extends Component {}
Using Simple, I can deserialize the following XML easily:
<ComponentList>
<Component class="a.b.c.d.TextField" />
<Component class="a.b.c.d.TextArea" />
<Component class="a.b.c.d.Choice" />
</ComponentList>
I would like to be able to use the following instead:
<ComponentList>
<TextField" />
<TextArea" />
<Choice" />
</ComponentList>
and specify how TextField maps to an a.b.c.d.TextField in the java
code. (Perhaps using some kind of Strategy?)
Is this possible?
Thanks,
Carl
|