-
- All Implemented Interfaces:
-
io.ably.lib.objects.type.ObjectLifecycleChange,io.ably.lib.objects.type.map.LiveMapChange
public interface LiveMap implements LiveMapChange, ObjectLifecycleChange
The LiveMap interface provides methods to interact with a live, real-time map structure. It supports both synchronous and asynchronous operations for managing key-value pairs.
-
-
Method Summary
Modifier and Type Method Description abstract LiveMapValueget(@NotNull() String keyName)Retrieves the value associated with the specified key.If this map object is tombstoned (deleted), null is returned.If no entry is associated with the specified key, null is returned.If map entry is tombstoned (deleted), null is returned.If the value associated with the provided key is an objectId string of another RealtimeObject, a reference tothat RealtimeObject is returned, provided it exists in the local pool and is not tombstoned. abstract Iterable<Map.Entry<String, LiveMapValue>>entries()Retrieves all entries (key-value pairs) in the map. abstract Iterable<String>keys()Retrieves all keys in the map. abstract Iterable<LiveMapValue>values()Retrieves all values in the map. abstract voidset(@NotNull() String keyName, @NotNull() LiveMapValue value)Sets the specified key to the given value in the map.Send a MAP_SET operation to the realtime system to set a key on this LiveMap object to a specified value.This does not modify the underlying data of this LiveMap object. abstract voidremove(@NotNull() String keyName)Removes the specified key and its associated value from the map.Send a MAP_REMOVE operation to the realtime system to tombstone a key on this LiveMap object.This does not modify the underlying data of this LiveMap object. abstract Longsize()Retrieves the number of entries in the map. abstract voidsetAsync(@NotNull() String keyName, @NotNull() LiveMapValue value, @NotNull() ObjectsCallback<Void> callback)Asynchronously sets the specified key to the given value in the map.Send a MAP_SET operation to the realtime system to set a key on this LiveMap object to a specified value.This does not modify the underlying data of this LiveMap object. abstract voidremoveAsync(@NotNull() String keyName, @NotNull() ObjectsCallback<Void> callback)Asynchronously removes the specified key and its associated value from the map.Send a MAP_REMOVE operation to the realtime system to tombstone a key on this LiveMap object.This does not modify the underlying data of this LiveMap object. -
Methods inherited from class io.ably.lib.objects.type.map.LiveMapChange
subscribe, unsubscribe, unsubscribeAll -
Methods inherited from class io.ably.lib.objects.type.ObjectLifecycleChange
off, offAll, on -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
get
@Nullable() abstract LiveMapValue get(@NotNull() String keyName)
Retrieves the value associated with the specified key.If this map object is tombstoned (deleted), null is returned.If no entry is associated with the specified key, null is returned.If map entry is tombstoned (deleted), null is returned.If the value associated with the provided key is an objectId string of another RealtimeObject, a reference tothat RealtimeObject is returned, provided it exists in the local pool and is not tombstoned. Otherwise, null is returned.If the value is not an objectId, then that value is returned.Spec: RTLM5, RTLM5a
- Parameters:
keyName- the key whose associated value is to be returned.
-
entries
@NotNull()@Unmodifiable() abstract Iterable<Map.Entry<String, LiveMapValue>> entries()
Retrieves all entries (key-value pairs) in the map.Spec: RTLM11, RTLM11a
-
keys
@NotNull()@Unmodifiable() abstract Iterable<String> keys()
Retrieves all keys in the map.Spec: RTLM12, RTLM12a
-
values
@NotNull()@Unmodifiable() abstract Iterable<LiveMapValue> values()
Retrieves all values in the map.Spec: RTLM13, RTLM13a
-
set
@Blocking() abstract void set(@NotNull() String keyName, @NotNull() LiveMapValue value)
Sets the specified key to the given value in the map.Send a MAP_SET operation to the realtime system to set a key on this LiveMap object to a specified value.This does not modify the underlying data of this LiveMap object. Instead, the change will be applied whenthe published MAP_SET operation is echoed back to the client and applied to the object following the regularoperation application procedure.Spec: RTLM20
- Parameters:
keyName- the key to be set.value- the value to be associated with the key.
-
remove
@Blocking() abstract void remove(@NotNull() String keyName)
Removes the specified key and its associated value from the map.Send a MAP_REMOVE operation to the realtime system to tombstone a key on this LiveMap object.This does not modify the underlying data of this LiveMap object. Instead, the change will be applied whenthe published MAP_REMOVE operation is echoed back to the client and applied to the object following the regularoperation application procedure.Spec: RTLM21
- Parameters:
keyName- the key to be removed.
-
size
@Contract(pure = true)@NotNull() abstract Long size()
Retrieves the number of entries in the map.Spec: RTLM10, RTLM10a
-
setAsync
@NonBlocking() abstract void setAsync(@NotNull() String keyName, @NotNull() LiveMapValue value, @NotNull() ObjectsCallback<Void> callback)
Asynchronously sets the specified key to the given value in the map.Send a MAP_SET operation to the realtime system to set a key on this LiveMap object to a specified value.This does not modify the underlying data of this LiveMap object. Instead, the change will be applied whenthe published MAP_SET operation is echoed back to the client and applied to the object following the regularoperation application procedure.Spec: RTLM20
- Parameters:
keyName- the key to be set.value- the value to be associated with the key.callback- the callback to handle the result or any errors.
-
removeAsync
@NonBlocking() abstract void removeAsync(@NotNull() String keyName, @NotNull() ObjectsCallback<Void> callback)
Asynchronously removes the specified key and its associated value from the map.Send a MAP_REMOVE operation to the realtime system to tombstone a key on this LiveMap object.This does not modify the underlying data of this LiveMap object. Instead, the change will be applied whenthe published MAP_REMOVE operation is echoed back to the client and applied to the object following the regularoperation application procedure.Spec: RTLM21
- Parameters:
keyName- the key to be removed.callback- the callback to handle the result or any errors.
-
-
-
-