Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to map arraylist containing a list of hashmaps using castor

 
radi ranga
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We want map an arraylist containing a list of hashmap using castor. We are mapping it as given below. With this mapping we are getting an arraylist containing hashmaps without any key/value pairs :( . Please help us in configuring the same.

[code]<class name="sample.ArrayListOfMaps">
<map-to xml="listofmaps" />
<field name="list" collection="arraylist" type="java.util.Map">
<bind-xml name="maps" node="element">
<class name="sample.SampleMap">
<map-to xml="mapItem" />
<field name="mapp" collection="map">
<bind-xml name="innerMap">
<class name="org.exolab.castor.mapping.MapItem">
<field name="key" type="java.lang.String">
<bind-xml name="id" node="attribute" />
</field>
<field name="value" type="java.lang.Object">
<bind-xml name="Item" node="element" />
</field>
</class>
<bind-xml>
</field>
</class>
</bind-xml>
</field>
</class>[/code]

Regards,
Radhika
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic