Interface LiveMapPathObject

All Superinterfaces:
PathObject

public interface LiveMapPathObject extends PathObject
A PathObject whose underlying value is expected to be a LiveMap. Provides type-safe access to map-specific operations such as get(String), entries(), set(String, LiveMapValue), etc.

Calling channel.objects.getRoot()-equivalent navigation methods at the root of the graph always returns a LiveMapPathObject.

Operations on this type are best-effort: they resolve the path against the local LiveObjects graph at call time. Read operations return empty/null when the path does not resolve to a LiveMap; write operations complete the returned CompletableFuture exceptionally with an AblyException (status 400, code 92007) in that case.

Spec: RTTS6a

  • Method Details

    • get

      @NotNull @NotNull PathObject get(@NotNull @NotNull String key)
      Returns a new PathObject representing the child at key of the LiveMap at this path. Purely navigational - no resolution occurs.

      Spec: RTPO5

      Parameters:
      key - the child key to navigate to
      Returns:
      a PathObject pointing to this.path + key
    • at

      @NotNull @NotNull PathObject at(@NotNull @NotNull String path)
      Returns a new PathObject whose path is this path with the segments parsed from path appended. The path argument is a dot-delimited string; a backslash-escaped dot (\.) is treated as a literal dot within a segment.

      This is purely navigational - no resolution against the LiveObjects graph is performed by this call. liveMapPath.at("a.b.c") is equivalent to liveMapPath.get("a").asLiveMap().get("b").asLiveMap().get("c").

      Available only on LiveMapPathObject because deeper navigation is only meaningful when the current resolved value is a LiveMap. To traverse from an arbitrary PathObject, first cast via PathObject.asLiveMap().

      Spec: RTPO6

      Parameters:
      path - dot-delimited path to append to this path
      Returns:
      a new PathObject representing the deeper path
    • entries

      @NotNull @NotNull @Unmodifiable Iterable<Map.Entry<String,PathObject>> entries()
      Returns the entries (key, child PathObject) of the LiveMap at this path. Each child path is produced as if by calling get(String) with the corresponding key.

      Returns an empty iterable when the path does not resolve to a LiveMap.

      Spec: RTPO9

      Returns:
      an unmodifiable iterable of map entries; empty when not a LiveMap
    • keys

      @NotNull @NotNull @Unmodifiable Iterable<String> keys()
      Returns the keys of the LiveMap at this path.

      Returns an empty iterable when the path does not resolve to a LiveMap.

      Spec: RTPO10

      Returns:
      an unmodifiable iterable of keys; empty when not a LiveMap
    • values

      @NotNull @NotNull @Unmodifiable Iterable<PathObject> values()
      Returns the child PathObjects for each key in the LiveMap at this path.

      Returns an empty iterable when the path does not resolve to a LiveMap.

      Spec: RTPO11

      Returns:
      an unmodifiable iterable of child paths; empty when not a LiveMap
    • size

      @Nullable @Nullable Long size()
      Returns the size of the LiveMap at this path, or null when the path does not resolve to a LiveMap.

      Spec: RTPO12

      Returns:
      the number of (non-tombstoned) entries, or null
    • set

      @NotNull @NotNull CompletableFuture<Void> set(@NotNull @NotNull String key, @NotNull @NotNull LiveMapValue value)
      Sets a key on the LiveMap at this path to the provided value.

      Sends a MAP_SET operation to the realtime system; the local state is updated when the operation is echoed back. The returned future completes exceptionally with an AblyException (status 400, code 92005) if the path cannot be resolved, or (status 400, code 92007) if the resolved value is not a LiveMap.

      Spec: RTPO15

      Parameters:
      key - the key to set
      value - the value to associate with key
      Returns:
      a future that completes when the operation has been acknowledged
    • remove

      @NotNull @NotNull CompletableFuture<Void> remove(@NotNull @NotNull String key)
      Removes a key from the LiveMap at this path.

      Sends a MAP_REMOVE operation to the realtime system; the local state is updated when the operation is echoed back. Same error conditions as set(String, LiveMapValue) apply.

      Spec: RTPO16

      Parameters:
      key - the key to remove
      Returns:
      a future that completes when the operation has been acknowledged