I just found another way to do what I want.
Maybe I was doing wrong or maybe the framework does not look the attributes set on an @ElementList
property.
So I transformed my MyList
class like this :
class MyList { // notice it does not extend ArrayList<MyListElement> anymore
// Now I set this list in inline mode
@ElementList(entry = "MyListElement", type = MyListElement.class, inline = true)
private ArrayList<MyListElement> elementList;
@Attribute(name = "MyListAttribute")
private Long attribute;
}
and in my class A
:
class A {
@Element(name = "MyList")
private MyList myList;
}
That way, I get what I expect :
<A>
<MyList MyListAttribute="...">
<MyListElement></MyListElement>
</MyList>
</A>