History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XSTR-405
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Joerg Schaible
Reporter: John Redford
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XStream

Collections & Maps with named parts and no class attribute

Created: 07/Jun/07 11:33 AM   Updated: 22/Jan/08 12:43 AM
Component/s: Core
Affects Version/s: None
Fix Version/s: None

Issue Links:
Duplicate
 


 Description  « Hide
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>



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.