Re: [Simple-support] UnionList with non inline elements
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2011-04-13 09:24:49
|
To use non-inline use this
@Path("commands")
@UnionList({
@ElementList(entry="copyDir", inline=true, type=CommandCopy.class),
@ElementList(entry="cleanDir", inline=true, type=CommandCleanDir.class),
@ElementList(entry="diffDirs", inline=true, type=CommandDiffDirs.class),
@ElementList(entry="runModule", inline=true, type=CommandRunModule.class)
})
private ArrayList<ICommand> commands = new ArrayList<ICommand>();
The reason for the difference here is so that you can have a list of the same class entries based on the name of the list if you want non-inline.
Niall
}) private ArrayList<ICommand> commands = new ArrayList<ICommand>();
--- On Wed, 13/4/11, Raphael Jolivet <rap...@gm...> wrote:
From: Raphael Jolivet <rap...@gm...>
Subject: [Simple-support] UnionList with non inline elements
To: sim...@li...
Received: Wednesday, 13 April, 2011, 2:14 AM
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
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now! http://p.sf.net/sfu/ibm-webcastpromo
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|