- Type Parameters:
T- the event class this handler can handle
Used in event handler registration in place of its associated event handler. Its sole purpose is to break the otherwise strong reference between an event handler container and its associated event handler. While the container still holds strong reference to the registered
WeakEventHandlerproxy, the proxy itself references the original handler only weakly and so doesn't prevent it from being garbage collected. Until this weak reference is broken, any event notification received by the proxy is forwarded to the original handler.
- JavaFX 8.0
WeakEventHandlerCreates a new instance of
eventHandler- the original event handler to which to forward event notifications
wasGarbageCollectedpublic boolean wasGarbageCollected()Indicates whether the associated event handler has been garbage collected. Used by containers to detect when the storage of corresponding references to this
WeakEventHandleris no longer necessary.
trueif the associated handler has been garbage collected,
handlepublic void handle
(T event)Forwards event notification to the associated event handler.