Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.monte.media.beans
Class WeakPropertyChangeListener

    java.lang.Object
      org.monte.media.beans.WeakPropertyChangeListener

All Implemented Interfaces:
  java.beans.PropertyChangeListener, java.util.EventListener

    public class WeakPropertyChangeListener

extends java.lang.Object
implements java.beans.PropertyChangeListener

Property change listener that holds weak reference to a target property change listener. If the weak reference becomes null (meaning the delegate has been GC'ed) then this listener will remove itself from any beans that it receives events from. It isn't perfect, but it's a lot better than nothing... and presumably beans that no longer send out events probably don't care if their listeners weren't properly cleaned up. Design pattern: Proxy.

Version:
  $Id: WeakPropertyChangeListener.java 156 2012-01-28 16:08:21Z werner $
Author:
  Paul Speed

Constructor Summary
`WeakPropertyChangeListener(java.beans.PropertyChangeListener target)`

Method Summary
`java.beans.PropertyChangeListener` | `getTarget()` Returns the target of this proxy.
`void` | `propertyChange(java.beans.PropertyChangeEvent event)`
`protected void` | `removeFromSource(java.beans.PropertyChangeEvent event)` Method that can be subclassed to provide additional remove support.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### WeakPropertyChangeListener

    public WeakPropertyChangeListener(java.beans.PropertyChangeListener target)

Method Detail

### removeFromSource

    protected void removeFromSource(java.beans.PropertyChangeEvent event)

  Method that can be subclassed to provide additional remove support. Default implementation only supports StandardBeans.

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent event)

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`

### getTarget

    public java.beans.PropertyChangeListener getTarget()

  Returns the target of this proxy. Returns null if the target has been garbage collected.

  Returns:
    The target or null.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD