Hi,> > doesn't know the exact type... so I use the javaObjectValue method to >
> Value has a type() method which tells you what kind of Value you've got. >
javaObjectValue() won't create an object -- it will only return an exusting >
object, if there is one (for resolved values, only for types RU.STRING, >
RU.SYMBOL, RU.JAVA_OBJECT.)
Then I can switch on the type returned to do the Jess->Java transfer correctly.
> >> > Second Problem : A second UserFunction return a integer value by doing
> >> > :> > int x = ... ;> > return new Value(x);> > My first reaction was that
> >> > the Value constructor that takes only an int isn't > public -- have you
> >> > modified the source? You should be using the two-argument > one that
> >> > lets you specify a type. But now, on re-reading, I see what's > probably
> >> > happening: *autoboxing* in Java 5 and up. You're passing only an int >
> >> > to the Value constructor, and there *is* no constructor that takes only
> >> > an > int. There is one that takes only an Object, though, so Java is
> >> > helpfully > converting your int to an Integer, and then Jess is creating
> >> > a Value of type > JAVA_OBJECT. Grrr. > > Although Java 5 blurred the
> >> > distinction between int and Integer, Jess still > treats them as
> >> > distinct types. You should be using > > return new Value(x,
> >> > RU.INTEGER);> > and then everything should work fine.
Oops, I should have said that I had already figured that Java 5 features were
probably linked to the problem.
Any plan to fix the disparities between int and Integer in Jess ? (Probably not
for backward compatibilty?)
Again, thanks for all those quick and complete answers, many commercial
products(!) doesn't have such a good "customer service".
_________________________________________________________________
Soyez parmi les premiers à essayer Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d