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 LabsFAX: (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]