• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to handle enums ?

 
Zbyszko Palka
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

As I know I can't use enums like this:

where status is:

So, how do you usualy manage with enums in JSF (when you need to compare values) ?
I thought about methods isNew(), isShort(), etc. but it looks dirty.

Thanks,
Zbyszko
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is kind of "dirty" in one sense, but on the other hand, it keeps the JSF page focused on display instead of on logic, so in that sense it's cleaner.

I've had the same issues, and not just with enums, and decided that the best solution is to simply add the "is" methods and learn to love them.
 
Zbyszko Palka
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim.
I have added these getters, and it doesn't look very bad. During maintance we will have to update more code, but that is not 'big' problem.

BR.
Zbyszko
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!