public class Variant
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
protected boolean |
swigCMemOwn |
构造器和说明 |
---|
Variant()
Constructs a null Variant object.
|
Variant(boolean boolVal)
Constructs Variant object from a boolean.
|
Variant(double doubleVal)
Constructs Variant object from a double.
|
Variant(long longVal)
Constructs Variant object from an integer.
|
Variant(long cPtr,
boolean cMemoryOwn) |
Variant(java.lang.String string)
Constructs Variant object from a string.
|
Variant(StringVariantMap object)
Constructs Variant object from a map of values.
|
Variant(VariantVector array)
Constructs Variant object from a list of values.
|
限定符和类型 | 方法和说明 |
---|---|
void |
delete() |
boolean |
equals(java.lang.Object obj)
Checks if this object is equal to the specified object.
|
protected void |
finalize() |
static Variant |
fromString(java.lang.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.
|
static long |
getCPtr(Variant obj) |
double |
getDouble()
Returns the floating point value of this variant.
|
long |
getLong()
Returns the integer value of this variant.
|
Variant |
getObjectElement(java.lang.String key)
Returns the element of object with the specified key.
|
StringVector |
getObjectKeys()
Returns all the keys in the object.
|
java.lang.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.
|
java.lang.String |
toString()
Converts the variant to JSON string.
|
public Variant(long cPtr, boolean cMemoryOwn)
public Variant()
public Variant(boolean boolVal)
boolVal
- The boolean value.public Variant(long longVal)
longVal
- The integer value.public Variant(double doubleVal)
doubleVal
- The double value.public Variant(java.lang.String string)
string
- The string value.public Variant(VariantVector array)
array
- The array of JSON values.public Variant(StringVariantMap object)
object
- The map of JSON values.public static long getCPtr(Variant obj)
protected void finalize()
finalize
在类中 java.lang.Object
public void delete()
public boolean equals(java.lang.Object obj)
equals
在类中 java.lang.Object
obj
- The reference object.public int hashCode()
hashCode
在类中 java.lang.Object
public VariantType getType()
public java.lang.String getString()
public boolean getBool()
public long getLong()
public double getDouble()
public int getArraySize()
public Variant getArrayElement(int idx)
idx
- The index of the array element to return (starting from 0).public StringVector getObjectKeys()
public Variant getObjectElement(java.lang.String key)
key
- The key of the object element to return.public java.lang.String toString()
toString
在类中 java.lang.Object
public static Variant fromString(java.lang.String str)
str
- The JSON string to use for the variant.java.lang.Exception
- If the string parsing fails.