[Simple-support] Serializing List
Brought to you by:
niallg
|
From: Tyrel A. H. <ial...@gm...> - 2012-10-20 14:21:48
|
I am unable to serialize a list of Annotated objects is this possible
I have a Class that is annotated and I can serialize
them individually however if I put the items in a list and then try to
serialize the list it does not serialize anything
Sample:
@root
public MyClass{
@Attribute(name="name")
public string name;
@Attribute(name="id")
public int id;
public MyClass(@Attribute(name="name") String name,
@Attribute(name="id") int id)
{
this.name= name;
this.id = id;
}
}
List<MyClass> list = new ArrayList<MyClass>();
list.add(new MyClass("name 1", 1);
list.add(new MyClass("name 2",2);
serializer.write(list,output);
|