[Simple-support] UnionList with non inline elements
Brought to you by:
niallg
|
From: Raphael J. <rap...@gm...> - 2011-04-13 09:14:25
|
Hi,
I wanted to give a try to the new feature "Union list".
I have an heterogeneous list of elements wrapped in a parent list element
(not inline).
Here is a sample XML :
<script>
<purpose>Blab bla</purpose>
<commands>
<cleanDir dir="folder1" />
<cleanDir dir="folder2" />
<copyDir srcDir="folder3" destDir="folder1" fileFilter="*.txt" />
</commands>
</script>
And the corresponding annotations in my class :
@Root(name="script")
public class Script {
// Heterogeneous list of commands
@UnionList({
@ElementList(entry="copyDir", type=CommandCopy.class),
@ElementList(entry="cleanDir", type=CommandCleanDir.class),
@ElementList(entry="diffDirs", type=CommandDiffDirs.class),
@ElementList(entry="runModule", type=CommandRunModule.class)
})
private ArrayList<ICommand> commands = new ArrayList<ICommand>();
// Description of test case
@Element private String purpose;
}
When trying to parse it, I got the following error :
org.simpleframework.xml.core.PersistenceException: Duplicate annotation of
name 'commands' on org.simpleframework.xml.core.UnionListLabel@1126b07
at
org.simpleframework.xml.core.StructureBuilder.union(StructureBuilder.java:214)
at
org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:165)
Is it a bug, or do I miss something ?
Thanks for your help,
Regards,
Raphael
|