BlackBerry Spark Communications Services for iOS  1.11.0
BBMLiveMap Class Reference
Inheritance diagram for BBMLiveMap:
BBMContainer

Instance Methods

(void) - resync
 
(id) - valueForKey:
 
(NSArray *) - valuesForKeys:
 
(NSArray *) - allKeys
 
(NSArray *) - allValues
 
(id) - objectForKeyedSubscript:
 
(void) - addListener:
 
(void) - removeListener:
 
- Instance Methods inherited from BBMContainer
(NSString *) - identifierOfElement:
 
(void) - reset
 

Properties

BBMElementState state
 Returns the current state of this instance. A current state means the live map is not waiting for any operations to complete. A pending state indicates this object is waiting for an operation to complete. More...
 
- Properties inherited from BBMContainer
BBMDSModelmasterModel
 The top level container. required to resolve foreign keys. More...
 
NSString * type
 The container type. More...
 
NSString * className
 The name of the class the container holds or vends. More...
 
Class classObject
 The class the container holds or vends. More...
 
void(^ allElementsReceivedCompletion )(NSArray *)
 

Detailed Description

BBMLiveMap is a key-value container that automatically retrieves and updates its content via BBMDS.

The contained objects can be accessed with an NSDictionary-like interface. These objects are retrieved lazily when they are accessed by using their identifier, i.e. valueForKey:"SomeKey". If an object hasn't been retrieved previously, an unpopulated, newly created instance of BBMElement will be returned. At this point in time the state property for the live map will be set to pending. The values for this instance are then retrieved asynchronously and the live map and the object's state will be set to current once the operation has completed. This class supports modern objective C keyed subscript syntax ie: mapInstance[key].

Since
R3

Method Documentation

◆ addListener:()

- (void) addListener: (NSObject< BBMLiveListener > *)  listener

Add a listener to this live list

Parameters
listenerThe listener
Since
R3

◆ allKeys()

- (NSArray *) allKeys

Returns all of the keys for all of the objects currently stored in the LiveMap.

Returns
NSArray an array of strings of the keys of the mapped objects
Since
R3

◆ allValues()

- (NSArray *) allValues

Returns all of the objects currently stored in the LiveMap.

Returns
NSArray of object of type self.classObject
Since
R3

◆ objectForKeyedSubscript:()

- (id) objectForKeyedSubscript: (id)  key

Support for keyed subscripting. Instead of valueForKey, you may use liveMap[key];

Note
R4 supports both keys of type NSString and BBMCompositeKeys (where applicable)
See also
NSDictionary
Since
R3

Implements BBMContainer.

◆ removeListener:()

- (void) removeListener: (NSObject< BBMLiveListener > *)  listener

Remove a listener to this live list

Parameters
listenerThe listener
Since
R3

◆ resync()

- (void) resync

Re-requests all elements that are currently in the map.

Since
R3

◆ valueForKey:()

- (id) valueForKey: (id)  key

Fetches the value from the map corresponding to the given key. This may return nil if the key is malformed, otherwise it will return an object immediately. The object this returns will be in the "pending" state if the object is not currently in the map. An object in the pending state will transition to "current" once it is loaded or "missing" if no object exists for the given key.

Note
R4 supports both keys of type NSString and BBMCompositeKeys (for maps where this is applicable)
Parameters
keyThe key may be an NSString or a BBMCompositeKey subclass
Since
R3
See also
BBMCompositeKey

◆ valuesForKeys:()

- (NSArray*) valuesForKeys: (NSArray *)  keyArray

Returns an array of objects matching any keys in keyArray.

Parameters
keyArrayan array of keys
Since
R3
See also
BBMCompositeKey

Property Documentation

◆ state

- (BBMElementState) state
readnonatomicassign

Returns the current state of this instance. A current state means the live map is not waiting for any operations to complete. A pending state indicates this object is waiting for an operation to complete.

Since
R3