I have a temporary solution... If I move the enum to its own class Castor is
able to find it and not complain. So now the enum is at
com.mycompany.messaging.myproduct.Rights which Castor can find.
Going this route Castor is able to Marshal my EnumMap but it is throwing an
exception when trying to unmarshal it. I'll look/post that issue under a
different thread.
darrickc wrote:
>
> 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-tp22501922p22607701.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