Hi Cyrille, (and all)
Thanks for the response... I agree that there is the
possibly for name clashing, though as you note, this risk is pretty minor.
I would say that on creation the enumerations are stuffed into a map and if any
values do clash, then the name still is created as per the convention, but a
number is appended to the end of the "close" name... such as _A_VALUE,
_A_VALUE1, _A_VALUE2 etc.
And I do agree that using the constant naming convention
would be a nice idea as well...
On the same note, has there been any thought to using
actual Enums in the same fashion? I assume that a flag could be set via
wsdd indicating java 5 support (or not) and depending on this flag, enums are
either generated via typesafe enum pattern (as current) or via the new Enum
construct.
If i wanted to do any of this kind of work, how could I
contribute?
Thanks,
-Clint
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Cyrille Le
ClercSent: Thursday, October 27, 2005 7:48 PMTo:
axis-user@ws.apache.orgSubject: Re: [axis 1.x] Working with
enumerations
Hello Clint,I would also be insterested in such a feature but
it seems to be pretty complex.Indeed, the current version of axis uses
the actual value of the enumeration if it is a valid java variable name.
However, if it is not valid (like spaces in "this is my first value"), then the
generic name "valueXX" is used.To have meaningful names for such kind of
values, we need to define the conversion of unsupported characters (more or
less, everything except letters and numbers). If we replace every non
supported char by an underscore, we may face collisions.For example "a
value!" and "a value?" will return "a_value_". I admit the risk is very limited
but it still exists.Another way to do this may be to try to convert each
restriction value and see if there are collisions. If yes, go back to "valueXX"
; if yes, use the converted value.By the way, would it be intereting to
us java constant naming convention (uppercase with underscore) for such
variables as they are actual constants ?CyrillePS : the method
JavaEnumTypeWriter.getEnumValueIds() is in charge of getting names for these
constants-- Cyrille Le Clerc[EMAIL PROTECTED][EMAIL PROTECTED]
On 10/27/05, Dovholuk,
Clint [EMAIL PROTECTED] wrote:
Hello
all,I was wondering if there were some switch on WSDL2Java I haven't
comeacross yet which allows it to generate java 5 enum's instead of the
typesafe enum pattern.Or alternatively, if there was another,
different switch which allowed the type safe enum pattern to create values
one canactually code with.call me crazy, but _value1, _value2,
_value3 isn'tthe easiest to code with...Sure I could use
fromValue, but that's not nearly as nice to code with, and it's not
compile-time safe.Are there any plans on getting this feature as an
option on wsdl2java?I looked all over the net and jira but I can't get
quality hits back... Thanks,-Clint