objects with Map fields

View: New views
2 Messages — Rating Filter:   Alert me  

objects with Map fields

by Mark Volkmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I want to use XStream to write XML for objects that have a field that  
is a Map. That gives me something like this.

<artists class="tree-map">
   <no-comparator/>
   <entry>
     <string>some key</string>
     <artist>
       <!-- child elements omitted -->
     </artist>
   </entry>
   <!-- more entry elements go here -->
</artists>

I don't want the Map information in my XML. I really want output like  
this.

<artists>
   <artist>
     <!-- child elements omitted -->
   </artist>
   <!-- more artist elements go here -->
</artists>

Can I configure XStream to do this and still be able to read that XML  
back in to reconstruct the objects, including the Maps? I'm imagining  
that this could work if I could tell XStream which field of the Artist  
objects should be used for key values in the Map.

---
Mark Volkmann






smime.p7s (7K) Download Attachment

Re: objects with Map fields

by Mark Volkmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oops! Wrong mailing list.

On Jul 19, 2008, at 2:36 PM, Mark Volkmann wrote:

> I want to use XStream to write XML for objects that have a field  
> that is a Map. That gives me something like this.
>
> <artists class="tree-map">
>  <no-comparator/>
>  <entry>
>    <string>some key</string>
>    <artist>
>      <!-- child elements omitted -->
>    </artist>
>  </entry>
>  <!-- more entry elements go here -->
> </artists>
>
> I don't want the Map information in my XML. I really want output  
> like this.
>
> <artists>
>  <artist>
>    <!-- child elements omitted -->
>  </artist>
>  <!-- more artist elements go here -->
> </artists>
>
> Can I configure XStream to do this and still be able to read that  
> XML back in to reconstruct the objects, including the Maps? I'm  
> imagining that this could work if I could tell XStream which field  
> of the Artist objects should be used for key values in the Map.
>
> ---
> Mark Volkmann
>
>
>
>

---
Mark Volkmann






smime.p7s (7K) Download Attachment