Package io.ably.lib.objects.type.map
Class LiveMapValue
java.lang.Object
io.ably.lib.objects.type.map.LiveMapValue
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 -
Method Summary
Modifier and TypeMethodDescriptionbyte @NotNull []Gets the Binary value if this LiveMapValue represents a Binary.@NotNull BooleanGets the Boolean value if this LiveMapValue represents a Boolean.@NotNull com.google.gson.JsonArrayGets the JsonArray value if this LiveMapValue represents a JsonArray.@NotNull com.google.gson.JsonObjectGets the JsonObject value if this LiveMapValue represents a JsonObject.@NotNull LiveCounterGets the LiveCounter value if this LiveMapValue represents a LiveCounter.@NotNull LiveMapGets the LiveMap value if this LiveMapValue represents a LiveMap.@NotNull NumberGets the Number value if this LiveMapValue represents a Number.@NotNull StringGets the String value if this LiveMapValue represents a String.abstract @NotNull ObjectgetValue()Gets the underlying value.booleanisBinary()Returns true if this LiveMapValue represents a Binary value.booleanReturns true if this LiveMapValue represents a Boolean value.booleanReturns true if this LiveMapValue represents a JsonArray value.booleanReturns true if this LiveMapValue represents a JsonObject value.booleanReturns true if this LiveMapValue represents a LiveCounter value.booleanReturns true if this LiveMapValue represents a LiveMap value.booleanisNumber()Returns true if this LiveMapValue represents a Number value.booleanisString()Returns true if this LiveMapValue represents a String value.static @NotNull LiveMapValueof(byte @NotNull [] value) Creates a LiveMapValue from a Binary.static @NotNull LiveMapValueof(@NotNull com.google.gson.JsonArray value) Creates a LiveMapValue from a JsonArray.static @NotNull LiveMapValueof(@NotNull com.google.gson.JsonObject value) Creates a LiveMapValue from a JsonObject.static @NotNull LiveMapValueof(@NotNull LiveCounter value) Creates a LiveMapValue from a LiveCounter.static @NotNull LiveMapValueCreates a LiveMapValue from a LiveMap.static @NotNull LiveMapValueCreates a LiveMapValue from a Boolean.static @NotNull LiveMapValueCreates a LiveMapValue from a Number.static @NotNull LiveMapValueCreates a LiveMapValue from a String.
-
Constructor Details
-
LiveMapValue
public LiveMapValue()
-
-
Method Details
-
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
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
Gets the Number value if this LiveMapValue represents a Number.- Returns:
- the Number value
- Throws:
-
IllegalStateException- if this is not a Number value
-
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
Gets the LiveCounter value if this LiveMapValue represents a LiveCounter.- Returns:
- the LiveCounter value
- Throws:
-
IllegalStateException- if this is not a LiveCounter value
-
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
Creates a LiveMapValue from a Boolean.- Parameters:
-
value- the boolean value - Returns:
- a LiveMapValue containing the boolean
-
of
Creates a LiveMapValue from a Binary.- Parameters:
-
value- the binary value - Returns:
- a LiveMapValue containing the binary
-
of
Creates a LiveMapValue from a Number.- Parameters:
-
value- the number value - Returns:
- a LiveMapValue containing the number
-
of
Creates a LiveMapValue from a String.- Parameters:
-
value- the string value - Returns:
- a LiveMapValue containing the string
-
of
Creates a LiveMapValue from a JsonArray.- Parameters:
-
value- the JsonArray value - Returns:
- a LiveMapValue containing the JsonArray
-
of
Creates a LiveMapValue from a JsonObject.- Parameters:
-
value- the JsonObject value - Returns:
- a LiveMapValue containing the JsonObject
-
of
Creates a LiveMapValue from a LiveCounter.- Parameters:
-
value- the LiveCounter value - Returns:
- a LiveMapValue containing the LiveCounter
-
of
Creates a LiveMapValue from a LiveMap.- Parameters:
-
value- the LiveMap value - Returns:
- a LiveMapValue containing the LiveMap
-