Jess Information

Jess Home
Jess 7 Features
Download Now!
Online Demo

Documentation
FAQ
Manual
Mailing List
Jess Wiki

More information Related Web Sites
User Contributions
JSR94 Info
Developer's Log
About This Site

JESS ®, the Rule Engine for the JavaTM Platform

Jess Wiki: Property Change Events

Adding property change support to your POJOs (JavaBeans) is easy; it looks something like this:


import java.beans.*;

public class JavaBean implements java.io.Serializable {
    private String m_val;

    public String getFoo() { return m_val; }

    public void setFoo(String val) {
        String tmp = m_val;
        m_val = val;
        pcs.firePropertyChange("foo", tmp, m_val);
    }

    private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
    public void addPropertyChangeListener(PropertyChangeListener pcl) {
        pcs.addPropertyChangeListener(pcl);
    }
    public void removePropertyChangeListener(PropertyChangeListener pcl) {
        pcs.removePropertyChangeListener(pcl);
    }
}


Front Page | Sandbox | Recent Changes | Powered by Friki | Last Edited: 08 August 2006