You're describing the behaviour of
java.beans.Introspector.getBeanInfo(), which Jess uses. This method in
turn just implements its interpretation of the Java Beans
specification. The Spec is mute on this question, as far as I can
tell. It's easy to see how the getBeanInfo() method could get confused
and give up.
If you really need to do this, and you can't get by using a method
like setValFromString(String) instead, then you'll have to implement a
beanInfo object to describe the properties. getBeanInfo() (and thus
Jess) would then use the explicit description of the properties in the
BeanInfo object instead of looking at the method names and trying to
figure things out. it's pretty easy to do this using the
SimpleBeanInfo class as a base class.
I think Thomas Gentsch wrote:
>
> My understanding was that I could have e.g. a Java bean like
>
> public class tge {
> protected int val = 0;
> [...]
> }
>
> Now I could define (within the class of course)
>
> public void setVal(int v) {
> val = v;
> }
> public void setVal(String v) {
> val = some_conversion(v);
> }
>
> If I do that and then I want to reference an object of class 'tge' in a
> rule like:
>
> (defrule val-changed
> ?o <- (tge (OBJECT ?o-b) (val ?v))
> =>
> [...]
> )
>
> I get the usual get() -3 error and 'val' is not shown. If I remove the
> second setVal() method it works again.
> Why that? Is there any workaround?
>
> Again, thanks a lot :~)
>
> --
> Thomas Gentsch
>
> ---------------------------------------------------------------------
> 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
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------