[Simple-support] ElementListUnion - Duplicate annotation exception .
Brought to you by:
niallg
|
From: Shyam S. <sh...@ou...> - 2013-03-23 07:00:52
|
Hi,
I tried deseiarilizing a list object. Since I will know the type of the list only at run time , I declared it using ElementListUnion as :
Customer.java
@ElementListUnion({ @ElementList(inline = false, type = Thing.class), @ElementList(inline = false, type = AnotherThing.class) }) List<Object> things ;
My Response xml is :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><customer> <address> <no>122</no> <street>chennai</street> </address> <id>122</id> <name>James Bond</name> <things> <thing> <val>185</val> </thing> <thing> <val>162</val> </thing> </things></customer>
But Iam getting the following exception.
03-21 18:56:31.940: E/AndroidRuntime(2289): Caused by:org.simpleframework.xml.core.PersistenceException: Duplicate annotationof name 'things' on...@or....ElementListUnion(value=[@org.simpleframework.xml.ElementList(data=false,empty=true, entry=, inline=false, name=, required=true, type=classcom.data.Thing), @org.simpleframework.xml.ElementList(data=false,empty=true, entry=, inline=false, name=, required=true, type=classcom.data.AnotherThing)]) on field 'things' java.util.Listcom.data.Customer.things
When I remove one ElementList it works fine .eg. :
@ElementListUnion({ @ElementList(inline = false, type = Thing.class), })List<Object> things ;
is working fine.
Am I missing something here. Please Help. I have been on this for more than 3 days now.
Regards,Shyam S |