Re: BigDecimal vs WOConditional
Re: BigDecimal vs WOConditional
- Subject: Re: BigDecimal vs WOConditional
- From: Hugi Thordarson <email@hidden>
- Date: Tue, 17 Feb 2009 19:00:45 +0000
Heh, yeah- it's somewhat insane that the only way to find out how
WOConditional works is to decompile it (or by trial and error). And I
agree - WOConditional should only resolve to false for null or
(exactly) zero.
But since WOConditional's behaviour will never be modified, the
simplest way is probably to create your own conditional component/
element and just do a find/replace. Should be simple enough.
- hugi
On 17.2.2009, at 17:58, 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 :(
Anyway, this problem is pretty unimportant -- it's just an
interesting question, but it's of no real consequence. The really
important question is
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
_______________________________________________
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