Using Castor 1.2 I'm trying to unmarshal an EnumMap and I'm getting an
exception with the following message:
org.exolab.castor.xml.MarshalException: argument type mismatch{File: [not
available]; line: 2; column: 342}
I'm trying to unmarshal this class:
public class UserPartitionRights
{
private EnumMap<Rights, Boolean> rights;
public UserPartitionRights() {}
public EnumMap<Rights, Boolean> getRights()
{
return rights;
}
public void setRights(EnumMap<Rights, Boolean> newRights)
{
rights = newRights;
}
}
Where Rights is defined as:
public enum Rights
{
SeeJobs(ResourceType.Job), DeleteJobs(ResourceType.Job),
ChangeJobStatus(ResourceType.Job), ChangeJobSets(ResourceType.Job);
public final ResourceType resourceType;
Rights(ResourceType type)
{
resourceType = type;
}
public static Rights fromValue(final String value)
{
for (Rights c: Rights.values())
{
if (Rights.valueOf( value ) == c )
{
return c;
}
}
throw new IllegalArgumentException(value);
}
};
The Mapping file looks like:
<class name="com.rocsoft.messaging.qdirect.UserPartitionRights"
auto-complete="true">
<field name="rights" collection="map">
<bind-xml name="rights">
<class name="org.exolab.castor.mapping.MapItem">
<field name="key"
type="com.rocsoft.messaging.qdirect.Rights">
<bind-xml name="Right"
node="attribute"/>
</field>
<field name="value" type="boolean">
<bind-xml name="onOff" node="element"/>
</field>
</class>
</bind-xml>
</field>
</class>
The fromValue is getting called and I am returning the correct enum value,
after that it throws the exception. Marshaling works fine. RecourceType is
another enum, not sure if that matters or not.
Thanks in advance!
--
View this message in context:
http://www.nabble.com/Unmarshal-failing-to-unmarshal-an-EnumMap-tp22608080p22608080.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