Thanks Werner and Matthias. I guess the real solution would be to treat Java 5 Enums as special kinds of 'enum beans' - without constructors and setters (so unmarshalling is not possible) but everything else should be as normal as getters are available for the rest of what I want. For now I'll just have to create a 'class bean' and I can easily marshall a list of that.
Look forward to 1.1.3, specially cos I'm waiting on some thread-safety fixes you guys have! Keep up the good work. Rahul -----Original Message----- From: Werner Guttmann [mailto:[EMAIL PROTECTED] Sent: Monday, October 01, 2007 12:40 AM To: [email protected] Subject: Re: [castor-user] Marshalling Java 5 Enum Hi, please see inline .... Werner Agarwal, Rahul wrote: > Hi Werner, > > Well what is really want is to output the whole enum. So I have: > > VALUE1("name","message",1) > VALUE2("name2","message2",20) > ... > > I call say marshall(EnumSet.allOf(MyEnum.class)) <- marshall set > Or say marshall(MyEnum.values()) <- marshall array > > Should give: > > <values> > <value> > <raw>VALUE1</raw> > <name>name</name> > <message>message</message> > <code>1</code> > </value> > <value> > <raw>VALUE2</raw> > <name>name2</name> > <message>message2</message> > <code>20</code> > </value> > </values> I am not 100% ure this will be possible at all, but will come back with a definitive answer in due time. Please bear with me. This is one of the areas where you might suffer from a mismatch between two technologies: OO programming languages and XML. But let's defer discussions for the time being. > > > I'm actually using the 1.1.2 release. I have push this out to our > production environment in a month so cant use snapshots. Given that we have fixed a few things with Java 5 enum support, and added a few features, I don't think that this can be done with any other code that SVN trunk. Given your deployment schedule, I think you might be lucky there, as I am planning to make a new release available within two or three weeks. > > Thanks > Rahul > > > -----Original Message----- > From: Werner Guttmann [mailto:[EMAIL PROTECTED] > Sent: Friday, September 28, 2007 3:04 AM > To: [email protected] > Subject: Re: [castor-user] Marshalling Java 5 Enum > > Hi, > > What's the output you'd expect from marshalling ? And can I assume that > you are testng this agains the latest 1.1.3 snapshot release (as > important parts of the logic related to Java 5 enums has been > refactored). > > Werner > > Agarwal, Rahul wrote: >> The search function on the list doesn't work I'm probably asking a >> question that's been asked before... >> >> >> >> I am trying to Marshall a Java 5 enum that is multiple custom fields > like: >> >> >> enum MyEnum{ >> >> >> >> VALUE1("name", "message", "code") >> >> >> >> String getName... >> >> String getMessage... >> >> .. >> >> >> >> >> >> } >> >> >> >> How do I write a Castor mapping file for this? I'm trying to write >> <field name="name"... > but it doesn't work. I understand I cant >> unmarshall which is fine, I just want to be able to marshall the enum >> with its fields. Currently I'm only able to get it like >> <myenum>VALUE1</mayenum> >> >> >> >> Any help would be appreciated. (I know the workaround but I don't want > >> to unnecessarily create a bean which will basically be the same as my > enum). >> >> >> Thanks >> >> Rahul >> > > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

