I am getting the UserRightsMessage object back from the unmarshal, but the
userRights map of maps is empty... Here is my class and mapping file.
Note: UserPartitionRights is just a class with 3 booleans and appropriate
getters/setters.
public class UserRightsMessage extends Message
{
private Map<String, Map<String, UserRights>> usersRights;
public UserRightsMessage()
{
usersRights = new HashMap<String, Map<String,
UserRights>>();
}
public void setUsersRights(Map<String, Map<String,
UserPartitionRights>> newUserRights)
{
usersRights = newUserRights;
}
public Map<String, Map<String, UserPartitionRights>>
getUsersRights()
{
return usersRights;
}
}
And my mapping xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
"http://castor.org/mapping.dtd">
<mapping>
<class name="UserRightsMessage" auto-complete="true">
<field name="usersRights" collection="map">
<bind-xml name="usersRights">
<class name="org.exolab.castor.mapping.MapItem">
<field name="key" type="java.lang.String">
<bind-xml name="string1"
node="attribute"/>
</field>
<field name="value" collection="map">
<bind-xml name="nested">
<class
name="org.exolab.castor.mapping.MapItem">
<field name="key"
type="java.lang.String">
<bind-xml
name="PartitionName"/>
</field>
<field name="value"
type="UserPartitionRights">
<bind-xml
name="UserPartitionRights"/>
</field>
</class>
</bind-xml>
</field>
</class>
</bind-xml>
</field>
</class>
</mapping>
When I marshal the object I get (what looks to me) to be a proper XML
representation of the class:
<UserRightsMessage>
<usersRights string1="user">
<nested>
<PartitionName>Partition A</PartitionName>
<UserPartitionRights change-status="true" see-status="true"
change-sets="true"/>
</nested>
</usersRights>
</UserRightsMessage>
But when I call unmarshal on this the HashMap within UserRightsMessage is
empty. Here is how I'm creating my marshal and unmarshal objects:
mapping = new Mapping();
mapping.loadMapping( filename );
XMLContext context = new XMLContext();
context.addMapping( mapping );
unmarshaller = context.createUnmarshaller();
marshaller = context.createMarshaller();
--
View this message in context:
http://www.nabble.com/Map-of-Maps-marshals-but-fails-to-unmarshal-tp21613747p21613747.html
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email