Description
The Variant class allows you to define a container for variant values.
Constructors
Constructs this class and assignes a variant value.
publicVariant(Object value)
- value: Object - value to be assigned to this variant.
Fields
Properties
length
Gets the length of the array
publicInteger getLength()
- returns: number - length of the array or 0.
Sets a new array length
publicInteger setLength(Integer value)
- value: Integer - new array length
type
Gets a type of the variant value
publicVariantType getType()
- returns: VariantType - variant value type.
Instance methods
assign
Assignes a new value to this object.
publicvoid assign(Variant value)
- value: Variant - new value to be assigned.
clear
Clears this object and assignes a VariantType.Null type.
publicvoid clear()
clone
Clones the variant value
publicVariant clone()
- value: Variant - cloned value of this variant
equals
Compares this object to the specified one.
publicboolean equals(Object obj)
- obj: Object - object to be compared.
- returns: boolean - true if the objects are equal.
getByIndex
Gets an array element by its index.
publicVariant getByIndex(int index) throws Exception
- index: int - element’s index.
- returns: Variant - requested array element.
isEmpty
Checks is this variant value is empty.
publicboolean isEmpty()
- returns: boolean - true is this variant value is empty.
isNull
Checks is this variant value is Null.
publicboolean isNull()
- returns: boolean - true if this variant value is Null.
setByIndex
Sets an array element by its index.
publicvoid setByIndex(int index, Variant element) throws Exception
- index: int - element index.
- element: Variant - element value.
toString
Returns a string value for this object.
publicString toString()
- returns: String - string value for this object.
Static methods
fromArray
Creates a new variant from Array value.
fromBoolean
Creates a new variant from a Boolean value.
public staticVariant fromBoolean(boolean value)
- value: boolean - variant value.
- returns: Variant - created variant object.
fromDateTime
Creates a new variant from a DateTime value.
public staticVariant fromDateTime(ZonedDateTime value)
- value: ZonedDateTime - variant value.
- returns: Variant - created variant object.
fromDouble
Creates a new variant from a Double value.
public staticVariant fromDouble(Double value)
- value: Double - variant value.
- returns: Variant - created variant object.
fromFloat
Creates a new variant from a Float value.
public staticVariant fromFloat(Float value)
- value: Float - variant value.
- returns: Variant - created variant object.
fromInteger
Creates a new variant from an Integer value.
public staticVariant fromInteger(Integer value)
- value: Integer - variant value.
- returns: Variant - created variant object.
fromLong
Creates a new variant from a Long value.
public staticVariant fromLong(Long value)
- value: Long - variant value.
- returns: Variant - created variant object.
fromObject
Creates a new variant from an Object value.
public staticVariant fromObject(Object value)
- value: Object - variant value.
- returns: Variant - created variant object.
fromString
Creates a new variant from a String value.
public staticVariant fromString(String value)
- value: String - variant value.
- returns: Variant - created variant object.
fromTimeSpan
Creates a new variant from a TimeSpan value.
public staticVariant fromTimeSpan(Long value)
- value: Long - variant value.
- returns: Variant - created variant object.
getAsInteger
Gets a variant value as Integer
publicInteger getAsInteger()
- returns: Integer - variant value as Integer
setAsInteger
Sets a variant value as Integer
publicvoid setAsInteger(Integer value)
- value: Integer - variant value as Integer.
getAsLong
Gets a variant value as Long
publicLong getAsLong()
- returns: Long - variant value as Long.
setAsLong
Sets a variant value as Long
publicvoid setAsLong(Long value)
- value: Long - variant value as Long.
getAsBoolean
Gets a variant value as Boolean.
publicBoolean getAsBoolean()
- returns: Boolean - variant value as Boolean.
setAsBoolean
Sets a variant value as Boolean.
publicvoid setAsBoolean(Boolean value)
- value: Boolean - variant value as Boolean.
getAsFloat
Sets a variant value as Float.
publicFloat getAsFloat()
- returns: Long - variant value as Float.
setAsFloat
Sets a variant value as Float.
publicvoid setAsFloat(Float value)
- value: Long - variant value as Float.
getAsDouble
Gets a variant value as Double.
publicDouble getAsDouble()
- returns: Double - vvariant value as Double.
setAsDouble
Sets a variant value as Double.
publicvoid setAsDouble(Double value)
- value: Double - vvariant value as Double.
getAsString
Gets a variant value as String.
publicString getAsString()
- returns: String - variant value as String.
setAsString
Sets a variant value as String.
publicvoid setAsString(String value)
- value: String - variant value as String.
getAsObject
Gets a variant value as Object
publicObject getAsObject()
- returns: Object - created variant object.
setAsObject
Sets variant value as Object
publicvoid setAsObject(Object value)
- value: Object - created variant object.