public interface ListenerHandle extends ListenerAttachHandle, ListenerDetachHandle
attach
and detach
a listener to/from some
observable instance.
Using the handler the calling code does not have to manage references to both the observed instance and the listener, which can improve readability.
A handle is created and returned by methods which connect a listener with an observable instance. This usually means
that the listener is actually added to the observable but it is also possible to simply return a handler and wait for
the call to attach()
before adding the listener. It is up to such methods to specify this behavior.
Unless otherwise noted it is not safe to share a handle between different threads. The behavior is undefined if
parallel calls are made to attach()
and/or detach()
.
attach
detach
This documentation is licensed under CC-BY 4.0, attributed to Nicolai Parlog from CodeFX.