Java Detect Variable Change Using PropertyChangeSupport and PropertyChangeListener
- by Sam
I'm trying to print out debug statements when some third party code changes a variable. For example, consider the following:
public final class MysteryClass {
private int secretCounter;
public synchronized int getCounter() {
return secretCounter;
}
public synchronized void incrementCounter() {
secretCounter++;
}
}
public class MyClass…