When trying out Jess with Java Beans I realized that Jess does not rely on
standardized method names when manipulating JavaBeans. I think that Jess
somehow gets the propeties directly. For example, if I create a Bean as
follows:

public class ListBean implements Serializable
{
    private WhatEverType anyName = new WhatEverType();    // this might be a
vector holding integers...
    private transient PropertyChangeSupport pcs = new
PropertyChangeSupport();

    // 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 }

    // propertyChange stuff here... (addListener etc.)
}

... Jess will not realize that the Bean has a property named list holding
some sort of a list of integers. Consequently, the property appears neither
as multifield that must be of Java list type nor as any other convinient
list type. I even tried jess.ValueVector type but the result was not a
multifield but some external type. The only way I could access the list was
via method calls that are not very convinient in the LHS of rules...

Just to make it clear, the idea is that I want to have a vector
implementation of a resizable list that I would like to test and modify as a
multifield in the rules. The list would be inside a JavaBean. The advantage
in this approach is that I can instantly get results outside Jess engine
that runs in a separate thread. The thread gets input via events and sends
results via events.

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.

Please comment. Is there a major misunderstanding or do I just feel like it?

---------------------------------------------------------------------
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