[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-user
Subject:    RE: java ordering and numeric values of xml enumerations
From:       "Raul Acevedo" <raul () cantara ! com>
Date:       2007-05-30 18:46:59
Message-ID: 22292.63.81.96.200.1180550819.squirrel () www ! cantara ! com
[Download RAW message or body]

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:raul@cantara.com]
> Sent: Friday, May 25, 2007 12:24 PM
> To: user@xmlbeans.apache.org
> 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: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
> 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: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic