Hi,

darrickc wrote:
> 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. 
Fine by me, if that's okay for you. But somehow I still think that you
should create a separate issue for this, so that we can replay this.

> 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.
+1.

Cheers
Werner
> 
> 
> 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>... 
>>
> 

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to