java.lang.Object | |
↳ | com.carto.core.Variant |
JSON value. Can contain JSON-style structured data, including objects and arrays.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Variant()
Constructs a null Variant object.
| |||||||||||
Variant(boolean boolVal)
Constructs Variant object from a boolean.
| |||||||||||
Variant(long longVal)
Constructs Variant object from an integer.
| |||||||||||
Variant(double doubleVal)
Constructs Variant object from a double.
| |||||||||||
Variant(String string)
Constructs Variant object from a string.
| |||||||||||
Variant(VariantVector array)
Constructs Variant object from a list of values.
| |||||||||||
Variant(StringVariantMap object)
Constructs Variant object from a map of values.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
containsObjectKey(String key)
Returns true if object elements contains the specified key.
| ||||||||||
synchronized void | delete() | ||||||||||
boolean |
equals(Object obj)
Checks if this object is equal to the specified object.
| ||||||||||
static Variant |
fromString(String str)
Creates a Variant object from a JSON string representation.
| ||||||||||
Variant |
getArrayElement(int idx)
Returns the element of array at specified position.
| ||||||||||
int |
getArraySize()
Returns the number of elements in the array.
| ||||||||||
boolean |
getBool()
Returns the boolean value of this variant.
| ||||||||||
double |
getDouble()
Returns the floating point value of this variant.
| ||||||||||
long |
getLong()
Returns the integer value of this variant.
| ||||||||||
Variant |
getObjectElement(String key)
Returns the element of object with the specified key.
| ||||||||||
StringVector |
getObjectKeys()
Returns all the keys in the object.
| ||||||||||
String |
getString()
Returns the string value of this variant.
| ||||||||||
VariantType |
getType()
Returns the type of this variant.
| ||||||||||
int |
hashCode()
Returns the hash value of this object.
| ||||||||||
String |
toString()
Converts the variant to JSON string.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Constructs a null Variant object.
Constructs Variant object from a boolean.
boolVal | The boolean value. |
---|
Constructs Variant object from an integer.
longVal | The integer value. |
---|
Constructs Variant object from a double.
doubleVal | The double value. |
---|
Constructs Variant object from a string.
string | The string value. |
---|
Constructs Variant object from a list of values.
array | The array of JSON values. |
---|
Constructs Variant object from a map of values.
object | The map of JSON values. |
---|
Returns true if object elements contains the specified key.
key | The key of the object element to check. |
---|
Checks if this object is equal to the specified object.
obj | The reference object. |
---|
Creates a Variant object from a JSON string representation.
str | The JSON string to use for the variant. |
---|
Exception | If the string parsing fails. |
---|
Returns the element of array at specified position.
idx | The index of the array element to return (starting from 0). |
---|
Returns the number of elements in the array.
Returns the boolean value of this variant.
Returns the floating point value of this variant.
Returns the integer value of this variant.
Returns the element of object with the specified key.
key | The key of the object element to return. |
---|
Returns all the keys in the object.
Returns the string value of this variant.
Returns the hash value of this object.
Converts the variant to JSON string.