On Aug 8, 2007, at 18:30, Vincent Hennebert wrote:

-    public int getValue() {
- log.error("getValue() called on " + enumProperty + " number");
-        return 0;

That may be discussed, but I have strong feelings against that. If the
method shouldn’t be called, why not throw an IllegalStateException or

Good idea, much better than the above! Didn't quite occur to me to do that. Then again, in case you didn't notice: those lines are removed...(?)

If it is called that means there’s a bug somewhere. Perhaps the code
won’t crash, perhaps nothing will even be noticeable on the output, but
I doubt it as there can only be a serious problem, that should be
corrected sooner rather than later.

All that said... if most methods of the Numeric interface aren’t
applicable to EnumNumber, should that class still be considered as
a Numeric object? Does that make sense to cast an EnumNumber into
a Numeric?

Well, apparently, a long time ago, someone felt it necessary to have a Property type that stored an enum but in the end it's only a number (values like "no-limit"). The idea of an EnumNumber itself always seemed somewhat ugly to me, but I never took the time to come up with a decent alternative.



Reply via email to