Hi Albert,
OK -- that makes a bit of sense although the type-safe "feature" then
means it is not compile-time "safe" since you cannot use the static
variables (unless you want to use the NotificationType._value1, ...).
What I see, in practice, is things like:
nhq.setNotificationType(org.jtc.wo.NotificationType.fromString("data
delivery"));
instead of something that can be checked at compile time such as:
nhq.setNotificationType(org.jtc.wo.NotificationType.DATA_DELIVERY);
If the names were such as what I show instead of the _value1 pattern,
then the enumerations would be much more useful at compile time.
Best,
Joe
-----Original Message-----
From: Albert Lin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 19, 2003 5:09 PM
To: [EMAIL PROTECTED]
Subject: Re: Enumeration Question
This is because wsdl2java generates "typesafe enums" for each
enumeration. Basically, rather than just creating a series of "static
final" constants, it creates objects for each enumeration, which has a
major advantage of preventing you from assigning an invalid value to an
enumeration.
A good description of typesafe enums is here:
http://developer.java.sun.com/developer/Books/shiftintojava/page1.html
-- Albert
On Wednesday, November 19, 2003, at 12:55 PM, McDaniel, Joe wrote:
> Enumerations using wsdl2java get created (in my opinion) brain-dead.
> Is there a reason for (or a work around) the way that wsdl2java
> creates the static final parameters with names like Color._value1,
> Color._value2, etc. rather than something that could be useful such as
> Color.RED, Color.BLUE, etc.?
>
> Best,
>
> Joe McDaniel
>
>