This could be considered as two or three different changes, but they are all similar and related. The goal is to exercise greater control over the generated XML in the common cases of Collection and Map types.
Instead of having to choose between:
<parts class="linked-list">
<string>foo</string>
<string>bar</string>
</parts>
and making the collection implicit (allowing named elements):
<part>foo</part>
<part>bar</part>
I would like to have:
<parts>
<part>foo</part>
<part>bar</part>
</parts>
And deserialize into whatever type of collection is found in the class – I don't need/want the strong type checking.
I happen to like annotations, so I am thinking something like:
@XStreamAliasCollection(name="parts", omitClass="true", itemFieldName="part")
And something similar for Map types:
@XStreamAliasMap(name="parts", omitClass="true", entryFieldName="part", keyFieldName="partno", valueFieldName="partname")
to produce:
<parts>
<part>
<partno>1</partno>
<partname>foo</partname>
</part>
<part>
<partno>2</partno>
<partname>bar</partname>
</part>
</parts>
And also something like:
@XStreamAliasMap(name="parts", omitClass="true", entryFieldName="part", keyFieldName="partno", keyAsAttribute="true", valueImplicit="true"):
to produce:
<parts>
<part partno="1">foo</part>
<part partno="2">bar</part>
</parts>