Re: BigDecimal vs WOConditional
Re: BigDecimal vs WOConditional
- Subject: Re: BigDecimal vs WOConditional
- From: Chuck Hill <email@hidden>
- Date: Tue, 17 Feb 2009 12:24:19 -0800
On Feb 17, 2009, at 9:58 AM, Ondřej Čada wrote:
Hi,
On Feb 17, 2009, at 6:20 PM, Stamenkovic Florijan wrote:
Just for reference, is that my fault or WO fault? To be quite
frank, I cannot find in specifications the exact API contract for
this... I've always thought the C rules apply there (i.e., for any
numeric value, nonzero equals true), but quite clearly they do
not :(
The Java language specification does not allow conversion of non-
boolean primitives to boolean primitives. The java.lang.Number API
is consistent with this: it does not have a boolean-export method.
In short: there is no contract for this.
What on earth has Java and its contracts to do with this?!?
WebObjects are no Java; it's a language-independent framework,
actually designed for Objective C. The assumption that its number-to-
boolean translation is C-like is thus well-founded and very
reasonable (of course, unless _its_ documentation says otherwise).
The problem is "how exactly WebObjects should translate numeric
objects to boolean in .wod bindins". That's what should be somewhere
in the WO documentation (defintely not Java one), but I can't find
it there :(
This functionality is in WOAssociation, booleanValueInComponent.
Clearly what you are seeing is a bug in the implementation as the
behavior does not match the documentation. Please file a bug.
Anyway, this problem is pretty unimportant -- it's just an
interesting question, but it's of no real consequence. The really
important question is
No I have no ideas, other than to use Wonder's patching to install a
fixed WOAssociation class.
Chuck
On Feb 17, 2009, at 6:08 PM, Ondřej Čada wrote:
... does anybody know some trick how to find in a medium-sized
project (about 16000 .wod lines in total) all WOConditionals whose
condition is a BigDecimal, and append ".signum" to the condition?
(The project's Xcode, so I can use its regexp search&replace, or of
course some external sed-based script... but I see no way to find
the BigDecimal conditions only :( )
:)
Thanks and best,
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden