public class SoftPropertyChangeListener
extends java.lang.Object
implements java.beans.PropertyChangeListener
If the original listener is garbage collected, this property change listener is just doing nothing. Note that although the referenced listener and everything what is attached to it might be released, this listener is still attached to all classes it was added as a property change listener, because it has no chance to know where it was added, so it cannot remove itself.
Constructor and Description |
---|
SoftPropertyChangeListener(java.beans.PropertyChangeListener wrapped)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isValid()
Is this listener still valid?
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
This method gets called when a bound property is changed.
|
public SoftPropertyChangeListener(@NotNull java.beans.PropertyChangeListener wrapped)
wrapped
- listener to wrap, which is only hold via a weak referencepublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
evt
- A PropertyChangeEvent object describing the event source
and the property that has changed.public boolean isValid()
true
if the reference is still availablefalse
if it is no longer available