I think Kai Noponen wrote:
> When trying out Jess with Java Beans I realized that Jess does not rely on
> standardized method names when manipulating JavaBeans....
Jess uses java.beans.Introspector, and so it by definition uses the
"official" Beans conventions; it will even use a BeanInfo object if
you supply one.
> // methods that read the property
> public synchronized int[] getList() { // return whole list; }
> public synchronized int[] getList(int index) { // return an item at
> index; }
>
> // methods that write to the property
> public synchronized void setList(int[] l) { // change list and fire
> PropertyChange }
> public synchronized void setList(int index, int v) { // change an item
> in the list and fire PropertyChange }
Huh. I don't know -what- the spec says about overloaded setters and
getters like this; it's quite possible that the Introspector class is
hopelessly confused by this and doesn't report ANY property named
"list" at all (especially if the above is verbatim; an indexed int
array property accessor should return int, not int[].) In any case if
the ony get/set methods were
public synchronized int[] getList();
public synchronized void setList(int[] l);
Then the corresponding generated deftemplate would contain a
multislot named "list," whose elements were the array elements of the
property. Jess doesn't support indexed properties - I can't actually
imagine how they would map onto the existing LHS data model, can you?
>
> Another thing that confused me was that it seemed that Jess did not rely on
> the propertyChangeEvents. I deliberately put wrong values in the oldValue
> and newValue fields of the event constructor but Jess still shows the right
> changed values. So, it ignores the event and checks the property directly. I
> think this is against the whole idea of event handling.
Jess will actually use the value of a property from a
PropertyChangeEvent if a name for the changed property is provided in
the event. If either the property name or new value are null or
invalid, Jess will call the appropriate accessor methods. The oldValue
field is always ignored. One possible explanation for your observation
is that perhaps you misspelled the property name; i.e., the name for
the array property above is "list," although many people expect it to be
"List."
---------------------------------------------------------
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]
---------------------------------------------------------------------