I have this code:
@ElementList(name="package", required=false, inline=true)
private Hashtable<String, PackageListItem> packages;
which gives me this error:
D/debug(22150): java.util.Hashtable cannot be cast to java.util.Collection
I tried to fix that using a getter:
@ElementList(name="package", required=false, inline=true)
private Collection<PackageListItem> getPackageXML() {
return packages.values();
}
but that gives me an error I don't quite understand:
D/debug(22307): Default constructor can not accept read only @org.simpleframework.xml.ElementList(data=false, empty=true, entry=, inline=true, name=package, required=false, type=void) on method 'packageXML' in class com.example.MyClass
I know I can use a ElementMap
, but that gives too much information in my XML.
How can I serialize the values of a Hashtable
in Simple 2.7.1?