I'm having an issue where I'm trying to map a simple enum (below) and I keep
getting exceptions from Castor (1.2) when trying to load the mapping file.
Here is the exception
org.exolab.castor.mapping.MappingException: Could not find the class
com.mycompany.messaging.myproduct.UserPartitionRights.Rights
Here is the UserPartitionRights class:
package com.mycompany.messaging.myproduct;
public class UserPartitionRights
{
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);
}
};
And here is the relevant section of my mapping file:
<class name="com.mycompany.messaging.myproduct.UserPartitionRights">
<field name="aRights"
type="com.mycompany.messaging.myproduct.UserPartitionRights.Rights">
<bind-xml name="aRights" />
</field>
</class>
My ultimate goal is to be able to (un)marshal an EnumMap<Rights, Boolean>...
--
View this message in context:
http://www.nabble.com/Java-5-enum-mapping-tp22501922p22501922.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