Class Variant
- java.lang.Object
-
- com.snowflake.snowpark_java.types.Variant
-
- All Implemented Interfaces:
Serializable
public class Variant extends Object implements Serializable
Representation of Snowflake Variant data- Since:
- 0.8.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Variant(boolean value)
Creates a Variant from boolean value.Variant(byte[] bytes)
Creates a Variant from binary value.Variant(double num)
Creates a Variant from double value.Variant(float num)
Creates a Variant from float value.Variant(int num)
Creates a Variant from int value.Variant(long num)
Creates a Variant from long value.Variant(short num)
Creates a Variant from short value.Variant(Object obj)
Creates a Variant from Object value.Variant(Object[] arr)
Creates a Variant from an array.Variant(String str)
Creates a Variant from String value.Variant(BigDecimal num)
Creates a Variant from BigDecimal value.Variant(BigInteger num)
Creates a Variant from BigInteger value.Variant(Date date)
Creates a Variant from Date value.Variant(Time time)
Creates a Variant from Time value.Variant(Timestamp timestamp)
Creates a Variant from Timestamp value.Variant(List<Object> list)
Creates a Variant from a list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Variant[]
asArray()
Converts the variant as array of Variant.BigDecimal
asBigDecimal()
Converts the variant as BigDecimal value.BigInteger
asBigInteger()
Converts the variant as BigInteger value.byte[]
asBinary()
Converts the variant as binary value.boolean
asBoolean()
Converts the variant as boolean value.Date
asDate()
Converts the variant as Date value.double
asDouble()
Converts the variant as double value.float
asFloat()
Converts the variant as float value.int
asInt()
Converts the variant as int value.String
asJsonString()
Converts the variant as valid Json String.List<Variant>
asList()
Converts the variant as list of Variant.long
asLong()
Converts the variant as long value.Map<String,Variant>
asMap()
Converts the variant as map of Variant.short
asShort()
Converts the variant as short value.String
asString()
Converts the variant as String value.Time
asTime()
Converts the variant as Time value.Timestamp
asTimestamp()
Converts the variant as Timestamp value.boolean
equals(Object other)
Checks whether two Variants are equal.int
hashCode()
Calculates the hash code of this Variant Object.String
toString()
An alias ofasString()
-
-
-
Constructor Detail
-
Variant
public Variant(float num)
Creates a Variant from float value.- Parameters:
num
- A float number- Since:
- 0.8.0
-
Variant
public Variant(double num)
Creates a Variant from double value.- Parameters:
num
- A double number- Since:
- 0.8.0
-
Variant
public Variant(long num)
Creates a Variant from long value.- Parameters:
num
- A long number- Since:
- 0.8.0
-
Variant
public Variant(int num)
Creates a Variant from int value.- Parameters:
num
- An int number- Since:
- 0.8.0
-
Variant
public Variant(short num)
Creates a Variant from short value.- Parameters:
num
- A short number- Since:
- 0.8.0
-
Variant
public Variant(BigDecimal num)
Creates a Variant from BigDecimal value.- Parameters:
num
- A BigDecimal number- Since:
- 0.8.0
-
Variant
public Variant(BigInteger num)
Creates a Variant from BigInteger value.- Parameters:
num
- A BigInteger number- Since:
- 0.8.0
-
Variant
public Variant(boolean value)
Creates a Variant from boolean value.- Parameters:
value
- A boolean value- Since:
- 0.8.0
-
Variant
public Variant(String str)
Creates a Variant from String value.- Parameters:
str
- A string value- Since:
- 0.8.0
-
Variant
public Variant(byte[] bytes)
Creates a Variant from binary value.- Parameters:
bytes
- An array of byte representing binary data- Since:
- 0.8.0
-
Variant
public Variant(Time time)
Creates a Variant from Time value.- Parameters:
time
- A Time object- Since:
- 0.8.0
-
Variant
public Variant(Date date)
Creates a Variant from Date value.- Parameters:
date
- A Date object- Since:
- 0.8.0
-
Variant
public Variant(Timestamp timestamp)
Creates a Variant from Timestamp value.- Parameters:
timestamp
- A Timestamp object- Since:
- 0.8.0
-
Variant
public Variant(List<Object> list)
Creates a Variant from a list.- Parameters:
list
- A list of data- Since:
- 0.8.0
-
Variant
public Variant(Object[] arr)
Creates a Variant from an array.- Parameters:
arr
- An array of data- Since:
- 0.8.0
-
Variant
public Variant(Object obj)
Creates a Variant from Object value.- Parameters:
obj
- Any Java object- Since:
- 0.8.0
-
-
Method Detail
-
asFloat
public float asFloat()
Converts the variant as float value.- Returns:
- A float number
- Since:
- 0.8.0
-
asDouble
public double asDouble()
Converts the variant as double value.- Returns:
- A double number
- Since:
- 0.8.0
-
asShort
public short asShort()
Converts the variant as short value.- Returns:
- A short number
- Since:
- 0.8.0
-
asInt
public int asInt()
Converts the variant as int value.- Returns:
- An int number
- Since:
- 0.8.0
-
asLong
public long asLong()
Converts the variant as long value.- Returns:
- A long number
- Since:
- 0.8.0
-
asBigDecimal
public BigDecimal asBigDecimal()
Converts the variant as BigDecimal value.- Returns:
- A BigDecimal number
- Since:
- 0.8.0
-
asBigInteger
public BigInteger asBigInteger()
Converts the variant as BigInteger value.- Returns:
- A BigInteger number
- Since:
- 0.8.0
-
asString
public String asString()
Converts the variant as String value.- Returns:
- A String number
- Since:
- 0.8.0
-
asJsonString
public String asJsonString()
Converts the variant as valid Json String.- Returns:
- A valid json string
- Since:
- 0.8.0
-
asBinary
public byte[] asBinary()
Converts the variant as binary value.- Returns:
- An array of byte representing binary data
- Since:
- 0.8.0
-
asTime
public Time asTime()
Converts the variant as Time value.- Returns:
- A Time data
- Since:
- 0.8.0
-
asDate
public Date asDate()
Converts the variant as Date value.- Returns:
- A Date data
- Since:
- 0.8.0
-
asTimestamp
public Timestamp asTimestamp()
Converts the variant as Timestamp value.- Returns:
- A Timestamp data
- Since:
- 0.8.0
-
asBoolean
public boolean asBoolean()
Converts the variant as boolean value.- Returns:
- a boolean value
- Since:
- 0.8.0
-
asArray
public Variant[] asArray()
Converts the variant as array of Variant.- Returns:
- An array of Variant
- Since:
- 0.8.0
-
asList
public List<Variant> asList()
Converts the variant as list of Variant.- Returns:
- A list of Variant
- Since:
- 0.8.0
-
asMap
public Map<String,Variant> asMap()
Converts the variant as map of Variant.- Returns:
- A map from String to Variant
- Since:
- 0.8.0
-
equals
public boolean equals(Object other)
Checks whether two Variants are equal.
-
hashCode
public int hashCode()
Calculates the hash code of this Variant Object.
-
-