java.lang.Object | |
↳ | android.databinding.CallbackRegistry<C, T, A> |
Known Direct Subclasses |
A utility for storing and notifying callbacks. This class supports reentrant modification of the callbacks during notification without adversely disrupting notifications. A common pattern for callbacks is to receive a notification and then remove themselves. This class handles this behavior with constant memory under most circumstances.
A subclass of CallbackRegistry.NotifierCallback
must be passed to
the constructor to define how notifications should be called. That implementation
does the actual notification on the listener. It is typically a static instance
that can be reused for all similar CallbackRegistries.
This class supports only callbacks with at most three parameters.
Typically, these are the notification originator and a parameter, with another to
indicate which method to call, but these may be used as required. If more than
three parameters are required or primitive types other than the single int provided
must be used, A
should be some kind of containing structure that
the subclass may reuse between notifications.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CallbackRegistry.NotifierCallback<C, T, A> | Class used to notify events from CallbackRegistry. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an EventRegistry that notifies the event with notifier.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a callback to be notified.
| |||||||||||
Removes all callbacks from the list.
| |||||||||||
Creates and returns a copy of this
Object .
| |||||||||||
Modifies
callbacks to contain all callbacks in the CallbackRegistry.
| |||||||||||
Makes a copy of the registered callbacks and returns it.
| |||||||||||
Returns true if there are no registered callbacks or false otherwise.
| |||||||||||
Notify all callbacks.
| |||||||||||
Remove a callback.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates an EventRegistry that notifies the event with notifier.
notifier | The class to use to notify events. |
---|
Add a callback to be notified. If the callback is already in the list, another won't be added. This does not affect current notifications.
callback | The callback to add. |
---|
Removes all callbacks from the list.
Creates and returns a copy of this Object
. The default
implementation returns a so-called "shallow" copy: It creates a new
instance of the same class and then copies the field values (including
object references) from this instance to the new instance. A "deep" copy,
in contrast, would also recursively clone nested objects. A subclass that
needs to implement this kind of cloning should call super.clone()
to create the new instance and then create deep copies of the nested,
mutable objects.
Modifies callbacks
to contain all callbacks in the CallbackRegistry.
callbacks | modified to contain all callbacks registered to receive events. |
---|
Makes a copy of the registered callbacks and returns it.
Returns true if there are no registered callbacks or false otherwise.
Notify all callbacks.
sender | The originator. This is an opaque parameter passed to
onNotifyCallback(Object, Object, int, Object) |
---|---|
arg | An opaque parameter passed to
onNotifyCallback(Object, Object, int, Object) |
arg2 | An opaque parameter passed to
onNotifyCallback(Object, Object, int, Object)
|
Remove a callback. This callback won't be notified after this call completes.
callback | The callback to remove. |
---|