Hi,
I tried that function, but it doesn't seem to exist on the
jess.ReflectFunctions class (I am using 7.0 beta 4.  There seems to be a a
"static Value a(Class, Object) throws JessException" method based on browsing
the class file. Could this be it?  

Also, in regards to the original question, just thought about something. 
Since returning "new Value(Boolean())" from my userfunction returns the Java
Object, I'm still not clear about why this didn't work:

(test (eq (ognl-get ?obj "booleanProperty") (Boolean.TRUE)))

shouldn't 'eq' call returnedObj.equals(Boolean.TRUE) ?

On Thu, 1 Dec 2005 09:15:01 -0800 (PST), ejfried wrote
> I think erich.oliphant wrote:
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > 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.
> > 
> 
> You know, there's not actually a public API for getting Jess to do
> those conversions on demand from Java, although you've made a good
> case as to why there should be. The method you want is the static
> method "jess.ReflectFunctions.objectToValue()", which takes two
> arguments, the object and the class of the Object; this is so that 
> you can pass (for example) java.lang.Boolean as a Boolean.class or 
> as a Boolean.TYPE -- i.e., a primitive. You could simply use obj and 
> obj.getClass() as the two arguments. Since it's private, you could 
> either change the source to make it public, or you could call the method
> reflectively using something like
> 
>    Object prop = ...
>    Method oTV = Class.forName("jess.ReflectFunctions")
> .getMethod("objectToValue");   oTV.setAccessible(true);   Value 
> result = (Value) oTV.invoke(null, new Object[] {prop, prop.getClass()
> });
> 
> Of course, you'd probably want to get the Method object and cache it
> in a member variable someplace, and then stick all of this into your
> own "objectToValue" method.
> 
> ---------------------------------------------------------
> 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