This is an automated email from the ASF dual-hosted git repository.

tkobayas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-docs.git


The following commit(s) were added to refs/heads/main by this push:
     new 2ab3c6777 [incubator-kie#7132] Clarify that insert(Object object, 
boolean dynam… (#4601)
2ab3c6777 is described below

commit 2ab3c6777cf161e75d4b460e523a4af1513b22f0
Author: Toshiya Kobayashi <[email protected]>
AuthorDate: Thu Oct 1 08:46:43 2026 +0900

    [incubator-kie#7132] Clarify that insert(Object object, boolean dynam… 
(#4601)
    
    * [incubator-kie#7132] Clarify that insert(Object object, boolean dynamic) 
is deprecated
    
    * fixed for accuracy
---
 .../_property-change-listeners-con.adoc            | 45 +++++++++++++++++++++-
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git 
a/drools-docs/src/modules/ROOT/pages/rule-engine/_property-change-listeners-con.adoc
 
b/drools-docs/src/modules/ROOT/pages/rule-engine/_property-change-listeners-con.adoc
index 62b6efd0d..70146bcfe 100644
--- 
a/drools-docs/src/modules/ROOT/pages/rule-engine/_property-change-listeners-con.adoc
+++ 
b/drools-docs/src/modules/ROOT/pages/rule-engine/_property-change-listeners-con.adoc
@@ -137,14 +137,55 @@ The {RULE_ENGINE} generates a compilation error if you 
use the `@watch` tag for
 
 
 @propertyChangeSupport::
-For facts that implement support for property changes as defined in the 
https://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/[JavaBeans
 Specification], this tag enables the {RULE_ENGINE} to monitor changes in the 
fact properties.
+For facts that support property changes as defined in the 
https://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/[JavaBeans
 Specification], this tag enables the {RULE_ENGINE} to monitor changes in the 
fact properties.
 +
 --
-.Example: Declare property change support in JavaBeans object
+To use this tag, your Java class must provide public 
`addPropertyChangeListener(PropertyChangeListener)` and 
`removePropertyChangeListener(PropertyChangeListener)` methods, and fire a 
`PropertyChangeEvent` (with the fact as the event source) when a monitored 
property changes. The `java.beans.PropertyChangeSupport` helper class is the 
simplest way to implement this, as shown in the following example.
+
+.Example: Java class with property change support
+[source,java]
+----
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+public class Person {
+    private PropertyChangeSupport changes = new PropertyChangeSupport(this);
+    private String name;
+    private int age;
+
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        changes.addPropertyChangeListener(listener);
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        changes.removePropertyChangeListener(listener);
+    }
+
+    public String getName() { return name; }
+
+    public void setName(String newName) {
+        String oldName = this.name;
+        this.name = newName;
+        changes.firePropertyChange("name", oldName, newName);
+    }
+
+    public int getAge() { return age; }
+
+    public void setAge(int newAge) {
+        int oldAge = this.age;
+        this.age = newAge;
+        changes.firePropertyChange("age", oldAge, newAge);
+    }
+}
+----
+
+.Example: Declare property change support in DRL type declaration
 [source]
 ----
 declare Person
     @propertyChangeSupport
 end
 ----
+
+NOTE: The `insert(Object object, boolean dynamic)` method is internal and 
deprecated. Use `insert(Object object)` instead with `@propertyChangeSupport`.
 --


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to