Thanks for the input.
I use the javabean style accessors in my own "enums".
And for the other parts of the sortware which is out of my control(the
corba part)
I'll just have to write customer tags.

Can't wait for java 1.5 (Tiger) comes out with enums.... sweeeeet.

-Henrik Bentel






Shawn Bayern <[EMAIL PROTECTED]> on 07/17/2003 02:05:34 PM

Please respond to "Tag Libraries Users List"
       <[EMAIL PROTECTED]>

To:    Tag Libraries Users List <[EMAIL PROTECTED]>
cc:

Subject:    Re: tag for checking "enum"?

On Thu, 17 Jul 2003 [EMAIL PROTECTED] wrote:

> By enums, I mean class, private constructor, public static final fields,
> etc.. Described many places in java articles.
> Example class

Such an "enum" is really only a loose pattern with no official
description; it would be hard to write a standard based on it.  Instead,
JSTL is based on the JavaBeans specification, so to get information from
instances, you'd want to ensure that the class has JavaBeans-style
accessors.  For instance, for the class you gave:

> public class Power implements Serializable {
>       public static final Power OFF = new Power(0);
>       public static final Power ON = new Power(1);
>
>       private int _value;
>       private Power(int value) {
>             _value= value;
>       }
>       ..
>       ..
>       ..
> }

... you'd want to add a 'getValue()' method, and then for a 'Power'
instance, you could write '${p.value}'.

--
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com


---------------------------------------------------------------------
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]

Reply via email to