Thanks for your response. It would be nice if that were officially documented somewhere... I would hope that if it were to ever change (e.g. the starting index changes to 0), it would be very well documented in release notes. :)
I think we're going to stick to using a switch to convert from XML enums to public static ints where we need to. Thanks, Raul > The answers are: > > 1. Yes > 2. They always start with index 1 > 3. Yes, but note that XmlBeans only generates Enum classes if the > enumeration is String-based, if you have an enumeration of ints, nothing > special gets generated (this is based on our experience that > enumerations of something else other than Strings are too difficult to > handle in the code and too difficult to use) > > As far as guarantees, I would say that the best guarantee that what I > said above happens in the real world is indeed to write a test and check > for yourself. If you then are able to submit that test back into > XmlBeans, it's an extra guarantee that this will never be broken in > future releases. > > Radu > > -----Original Message----- > From: Raul Acevedo [mailto:[EMAIL PROTECTED] > Sent: Friday, May 25, 2007 12:24 PM > To: [email protected] > Subject: java ordering and numeric values of xml enumerations > > Does XmlBeans guarantee that the Java enumerations it creates for XML > enumerations: > > 1. Are sequentially numbered, using the same order in the WSDL 2. > Start with index 0 (or 1) 3. The toString() of the resulting Java enum > yields the exact string used in the WSDL enum > > These seem like logical assumptions but they are not explicitly stated > as far as I can tell. We need to convert the enums from the WSDL Java > classes to business domain Java object enums. Sometimes these are > "real" > enums in JDK 1.4 using ValuedEnum, so we'd like to use the string > representation to convert back and forth. Sometimes we have domain > enums in the form of public static ints, so we want to know if we can > use a simple conversion of the integer value or need a big switch > statement. > > Any help is much appreciated. Ideally it'd be nice to have a pointer to > official documentation... I know I can run the code and see what > happens, but that's not very reassuring that it won't change without > official docs saying that's part of the XmlBeans contract. > > Raul > http://www.cantara.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > Notice: This email message, together with any attachments, may contain > information of BEA Systems, Inc., its subsidiaries and affiliated > entities, that may be confidential, proprietary, copyrighted and/or > legally privileged, and is intended solely for the use of the individual > or entity named in this message. If you are not the intended recipient, > and have received this message in error, please immediately return this by > email and then delete it. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

