Hi Andreas, Andreas L Delmelle a écrit : > 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 >> so? > > 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...(?)
Ok, I isolated the wrong snippet... Go below in the commit message, and you’ll find plenty of such lines with plus instead of minus :-P <snip/> >> 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. So we can consider that this class will eventually be removed/changed? Then this hack is more acceptable. What about a “TODO this is ugly and shall be removed”? Cheers, Vincent