BNZObserverRecord
Abstract
an internal class used by the BNZTransactionalNotificationCenter to manage registrations
Discussion
This class is used by the BNZTransactionalNotificationCenter to manage
registrations of objects to be informed about changes on certain other objects. The
objects that want to be informed are called "TransactionObserver", because they participate in the
commit phase of all transactions that contains a change they registered for.
This class holds the observer reference and manages the individual
observation record objects that are created whenever a registerTransactionObserver in
BNZTransactionalNotificationCenter is called.
For each observer, the BNZTransactionalNotificationCenter maintains one
observer record to contain all its single observation records.
Methods
Abstract: returns the observation record that contains the exact type and target.
- (BNZObservation*)observationForChangeType:(id)changeType onTarget:(id)target;
returns the observation record that contains the exact type and target.
there may only be one observation of the same changetype on the same target
(including the cases where change type or target are nil)
Result: the observation for the given params, if existing. nil else
Abstract: create a new record object
- (id)initWithObserver:(id)observer;
Parameters
Name | Description |
observer | the observer for this record |
Result: a new record object
- (BOOL)isEmpty;
Result: YES if no observations are contained in this record, NO otherwise
Abstract: find all observations that match the given change
- (NSArray*)stateDependentObservationsForChange:(id)change inCallback:(SEL)callback;
Parameters
Name | Description |
change | the change for wich all observations shall be found |
Result: an array containing all matching BNZObservation records
- (NSArray*)observationsForChange:(id)change;
Parameters
Name | Description |
change | a given change |
Result: all observations that match the change
- (id)observer;
Result: returns the observer for this record
Abstract: remove the observation of the given type on the target
- removeObservationForChangeType:(id)changeType onTarget:(id)target;
Parameters
Name | Description |
changeType | the type of the observed changes, or nil for all |
target | the observed object for changes, of nil for all |
Result: returns self
Abstract: set a new observation
- setObservation:(BNZObservation*)observation;
a call on registerTransactionObserver in BNZTransactionalNotificationCenter
results in a call to this method
Will overwrite a previous observation of the same type on the same target, if present
(hence "set" because there can only be one observation of the same type on the same
target for the same observer)
Parameters
Name | Description |
observation | the observation object |
Result: returns self
(Last Updated 8/31/2006)