Hmm, ok thanks, I understand better now.  However, jess.Userfunctions return
Value's so is there anything I can do in that case to activate the type
conversion?  I tried Value.resolve() but that did not help.

On Wed, 30 Nov 2005 18:47:38 -0800 (PST), ejfried wrote
> If you can a Java function from Jess, and that function returns a
> java.lang.Boolean, then Jess will turn it into a Jess boolean value
> (the symbols TRUE or FALSE, of type RU.SYMBOL).
> 
> On the other hand, new Value(Boolean.TRUE) will give you a Value of
> type RU.JAVA_OBJECT that contains a java.lang.Boolean object. No
> matter what you hand to this constructor, Jess will always give you
> an object of type RU.JAVA_OBJECT; no automatic conversions will be done.
> 
> So since you know what you have, you can look at the options. The 
> most straightforward thing would just be to say
> 
> (test ((ognl-get ?anObject "booleanProperty") booleanValue))
> 
> I'd be tempted to write an ognl-get-boolean function to make this a
> little less ugly.
> 
> I think erich.oliphant wrote:
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > Hi,
> > I'm trying to understand the type conversion model a bit better.  I've 
> > written
> > a Userfunction (ognl-get) that takes an object, and Object Graph Notation
> > Language (OGNL) expresssion, and any additional variables.  The OGNL 
> > evaluator
> > returns a plain Object which I just wrap in a jess.Value "new Value(obj)" 
> > and
> > return.  It's been working great as we have a pretty complex domain model.  
> > 
> > However, I now have a situation where the function is returing a Boolean 
> > that
> > I know is say 'true', i.e.
> > --
> > (ognl-get ?anObject "booleanProperty")
> > --
> > 
> > I assumed that the Jess type conversion would allow me to do something like 
> > --
> > (test (ognl-get ?anObject "booleanProperty")) 
> > --
> > implicity converting Boolean.TRUE to 'TRUE'.
> > When that failed, I assumed that the plain object was returned so I tried
> > --
> > (test (eq (ognl-get ?anObject "booleanProperty") (Boolean.TRUE)))
> > -- 
> > this still does not seem to do it.  
> > 
> > I assume that I am making an incorrect assumption :)  Any ideas ?
> > 
> > --------------------------------------------------------------------
> > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> > in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> > (use your own address!) List problems? Notify [EMAIL PROTECTED]
> > --------------------------------------------------------------------
> > 
> 
> ---------------------------------------------------------
> Ernest Friedman-Hill  
> Advanced Software Research          Phone: (925) 294-2154
> Sandia National Labs                FAX:   (925) 294-2234
> PO Box 969, MS 9012                 [EMAIL PROTECTED]
> Livermore, CA 94550         http://herzberg.ca.sandia.gov
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> 
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to