Class LiveMapValue

java.lang.Object
io.ably.lib.objects.type.map.LiveMapValue

public abstract class LiveMapValue extends Object
Abstract class representing the union type for LiveMap values. Provides strict compile-time type safety, implementation is similar to Gson's JsonElement pattern. Spec: RTO11a1 - Boolean | Binary | Number | String | JsonArray | JsonObject | LiveCounter | LiveMap
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byte @NotNull []
    Gets the Binary value if this LiveMapValue represents a Binary.
    @NotNull Boolean
    Gets the Boolean value if this LiveMapValue represents a Boolean.
    @NotNull com.google.gson.JsonArray
    Gets the JsonArray value if this LiveMapValue represents a JsonArray.
    @NotNull com.google.gson.JsonObject
    Gets the JsonObject value if this LiveMapValue represents a JsonObject.
    @NotNull LiveCounter
    Gets the LiveCounter value if this LiveMapValue represents a LiveCounter.
    @NotNull LiveMap
    Gets the LiveMap value if this LiveMapValue represents a LiveMap.
    @NotNull Number
    Gets the Number value if this LiveMapValue represents a Number.
    @NotNull String
    Gets the String value if this LiveMapValue represents a String.
    abstract @NotNull Object
    Gets the underlying value.
    boolean
    Returns true if this LiveMapValue represents a Binary value.
    boolean
    Returns true if this LiveMapValue represents a Boolean value.
    boolean
    Returns true if this LiveMapValue represents a JsonArray value.
    boolean
    Returns true if this LiveMapValue represents a JsonObject value.
    boolean
    Returns true if this LiveMapValue represents a LiveCounter value.
    boolean
    Returns true if this LiveMapValue represents a LiveMap value.
    boolean
    Returns true if this LiveMapValue represents a Number value.
    boolean
    Returns true if this LiveMapValue represents a String value.
    static @NotNull LiveMapValue
    of(byte @NotNull [] value)
    Creates a LiveMapValue from a Binary.
    static @NotNull LiveMapValue
    of(@NotNull com.google.gson.JsonArray value)
    Creates a LiveMapValue from a JsonArray.
    static @NotNull LiveMapValue
    of(@NotNull com.google.gson.JsonObject value)
    Creates a LiveMapValue from a JsonObject.
    static @NotNull LiveMapValue
    of(@NotNull LiveCounter value)
    Creates a LiveMapValue from a LiveCounter.
    static @NotNull LiveMapValue
    of(@NotNull LiveMap value)
    Creates a LiveMapValue from a LiveMap.
    static @NotNull LiveMapValue
    of(@NotNull Boolean value)
    Creates a LiveMapValue from a Boolean.
    static @NotNull LiveMapValue
    of(@NotNull Number value)
    Creates a LiveMapValue from a Number.
    static @NotNull LiveMapValue
    of(@NotNull String value)
    Creates a LiveMapValue from a String.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LiveMapValue

      public LiveMapValue()
  • Method Details

    • getValue

      @NotNull public abstract @NotNull Object getValue()
      Gets the underlying value.
      Returns:
      the value as an Object
    • isBoolean

      public boolean isBoolean()
      Returns true if this LiveMapValue represents a Boolean value.
      Returns:
      true if this is a Boolean value
    • isBinary

      public boolean isBinary()
      Returns true if this LiveMapValue represents a Binary value.
      Returns:
      true if this is a Binary value
    • isNumber

      public boolean isNumber()
      Returns true if this LiveMapValue represents a Number value.
      Returns:
      true if this is a Number value
    • isString

      public boolean isString()
      Returns true if this LiveMapValue represents a String value.
      Returns:
      true if this is a String value
    • isJsonArray

      public boolean isJsonArray()
      Returns true if this LiveMapValue represents a JsonArray value.
      Returns:
      true if this is a JsonArray value
    • isJsonObject

      public boolean isJsonObject()
      Returns true if this LiveMapValue represents a JsonObject value.
      Returns:
      true if this is a JsonObject value
    • isLiveCounter

      public boolean isLiveCounter()
      Returns true if this LiveMapValue represents a LiveCounter value.
      Returns:
      true if this is a LiveCounter value
    • isLiveMap

      public boolean isLiveMap()
      Returns true if this LiveMapValue represents a LiveMap value.
      Returns:
      true if this is a LiveMap value
    • getAsBoolean

      @NotNull public @NotNull Boolean getAsBoolean()
      Gets the Boolean value if this LiveMapValue represents a Boolean.
      Returns:
      the Boolean value
      Throws:
      IllegalStateException - if this is not a Boolean value
    • getAsBinary

      public byte @NotNull [] getAsBinary()
      Gets the Binary value if this LiveMapValue represents a Binary.
      Returns:
      the Binary value
      Throws:
      IllegalStateException - if this is not a Binary value
    • getAsNumber

      @NotNull public @NotNull Number getAsNumber()
      Gets the Number value if this LiveMapValue represents a Number.
      Returns:
      the Number value
      Throws:
      IllegalStateException - if this is not a Number value
    • getAsString

      @NotNull public @NotNull String getAsString()
      Gets the String value if this LiveMapValue represents a String.
      Returns:
      the String value
      Throws:
      IllegalStateException - if this is not a String value
    • getAsJsonArray

      @NotNull public @NotNull com.google.gson.JsonArray getAsJsonArray()
      Gets the JsonArray value if this LiveMapValue represents a JsonArray.
      Returns:
      the JsonArray value
      Throws:
      IllegalStateException - if this is not a JsonArray value
    • getAsJsonObject

      @NotNull public @NotNull com.google.gson.JsonObject getAsJsonObject()
      Gets the JsonObject value if this LiveMapValue represents a JsonObject.
      Returns:
      the JsonObject value
      Throws:
      IllegalStateException - if this is not a JsonObject value
    • getAsLiveCounter

      @NotNull public @NotNull LiveCounter getAsLiveCounter()
      Gets the LiveCounter value if this LiveMapValue represents a LiveCounter.
      Returns:
      the LiveCounter value
      Throws:
      IllegalStateException - if this is not a LiveCounter value
    • getAsLiveMap

      @NotNull public @NotNull LiveMap getAsLiveMap()
      Gets the LiveMap value if this LiveMapValue represents a LiveMap.
      Returns:
      the LiveMap value
      Throws:
      IllegalStateException - if this is not a LiveMap value
    • of

      @NotNull public static @NotNull LiveMapValue of(@NotNull @NotNull Boolean value)
      Creates a LiveMapValue from a Boolean.
      Parameters:
      value - the boolean value
      Returns:
      a LiveMapValue containing the boolean
    • of

      @NotNull public static @NotNull LiveMapValue of(byte @NotNull [] value)
      Creates a LiveMapValue from a Binary.
      Parameters:
      value - the binary value
      Returns:
      a LiveMapValue containing the binary
    • of

      @NotNull public static @NotNull LiveMapValue of(@NotNull @NotNull Number value)
      Creates a LiveMapValue from a Number.
      Parameters:
      value - the number value
      Returns:
      a LiveMapValue containing the number
    • of

      @NotNull public static @NotNull LiveMapValue of(@NotNull @NotNull String value)
      Creates a LiveMapValue from a String.
      Parameters:
      value - the string value
      Returns:
      a LiveMapValue containing the string
    • of

      @NotNull public static @NotNull LiveMapValue of(@NotNull @NotNull com.google.gson.JsonArray value)
      Creates a LiveMapValue from a JsonArray.
      Parameters:
      value - the JsonArray value
      Returns:
      a LiveMapValue containing the JsonArray
    • of

      @NotNull public static @NotNull LiveMapValue of(@NotNull @NotNull com.google.gson.JsonObject value)
      Creates a LiveMapValue from a JsonObject.
      Parameters:
      value - the JsonObject value
      Returns:
      a LiveMapValue containing the JsonObject
    • of

      @NotNull public static @NotNull LiveMapValue of(@NotNull @NotNull LiveCounter value)
      Creates a LiveMapValue from a LiveCounter.
      Parameters:
      value - the LiveCounter value
      Returns:
      a LiveMapValue containing the LiveCounter
    • of

      @NotNull public static @NotNull LiveMapValue of(@NotNull @NotNull LiveMap value)
      Creates a LiveMapValue from a LiveMap.
      Parameters:
      value - the LiveMap value
      Returns:
      a LiveMapValue containing the LiveMap