Spec-Zone .ru
спецификации, руководства, описания, API
|
T
- the event class this handler can handlepublic final class WeakEventHandler<T extends Event> extends java.lang.Object implements EventHandler<T>
WeakEventHandler
proxy, 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.Constructor and Description |
---|
WeakEventHandler(EventHandler<T> eventHandler)
Creates a new instance of
WeakEventHandler . |
Modifier and Type | Method and Description |
---|---|
void |
handle(T event)
Forwards event notification to the associated event handler.
|
boolean |
wasGarbageCollected()
Indicates whether the associated event handler has been garbage
collected.
|
public WeakEventHandler(EventHandler<T> eventHandler)
WeakEventHandler
.eventHandler
- the original event handler to which to forward event
notificationspublic boolean wasGarbageCollected()
WeakEventHandler
is no longer necessary.true
if the associated handler has been garbage
collected, false
otherwiseCopyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. Use is subject to