@Evolving public final class Literal extends Object implements Expression
Definition:
getValue() to fetch the literal value. Returned value type depends on the type
of the literal data type. See the getValue() for further details.
| Modifier and Type | Method and Description |
|---|---|
java.util.List<Expression> |
getChildren() |
DataType |
getDataType()
Get the datatype of the literal object.
|
Object |
getValue()
Get the literal value.
|
static Literal |
ofBinary(byte[] value)
Create a
binary type literal expression. |
static Literal |
ofBoolean(boolean value)
Create a
boolean type literal expression. |
static Literal |
ofByte(byte value)
Create a
byte type literal expression. |
static Literal |
ofDate(int daysSinceEpochUTC)
Create a
date type literal expression. |
static Literal |
ofDecimal(java.math.BigDecimal value,
int precision,
int scale)
Create a
decimal type literal expression. |
static Literal |
ofDouble(double value)
Create a
double type literal expression. |
static Literal |
ofFloat(float value)
Create a
float type literal expression. |
static Literal |
ofInt(int value)
Create a
integer type literal expression. |
static Literal |
ofLong(long value)
Create a
long type literal expression. |
static Literal |
ofNull(DataType dataType)
Create
null value literal. |
static Literal |
ofShort(short value)
Create a
short type literal expression. |
static Literal |
ofString(String value)
Create a
string type literal expression. |
static Literal |
ofTimestamp(long microsSinceEpochUTC)
Create a
timestamp type literal expression. |
static Literal |
ofTimestampNtz(long microSecondsEpoch)
Create a
timestamp_ntz type literal expression. |
String |
toString() |
public static Literal ofBoolean(boolean value)
boolean type literal expression.value - literal valueLiteral of type BooleanTypepublic static Literal ofByte(byte value)
byte type literal expression.public static Literal ofShort(short value)
short type literal expression.public static Literal ofInt(int value)
integer type literal expression.value - literal valueLiteral of type IntegerTypepublic static Literal ofLong(long value)
long type literal expression.public static Literal ofFloat(float value)
float type literal expression.public static Literal ofDouble(double value)
double type literal expression.value - literal valueLiteral of type DoubleTypepublic static Literal ofString(String value)
string type literal expression.value - literal valueLiteral of type StringTypepublic static Literal ofBinary(byte[] value)
binary type literal expression.value - binary literal value as an array of bytesLiteral of type BinaryTypepublic static Literal ofDate(int daysSinceEpochUTC)
date type literal expression.public static Literal ofTimestamp(long microsSinceEpochUTC)
timestamp type literal expression.microsSinceEpochUTC - microseconds since epoch time in UTC timezone.Literal with data type TimestampTypepublic static Literal ofTimestampNtz(long microSecondsEpoch)
timestamp_ntz type literal expression.microSecondsEpoch - Microseconds since epoch with no timezone.Literal with data type TimestampNTZTypepublic static Literal ofDecimal(java.math.BigDecimal value, int precision, int scale)
decimal type literal expression.value - decimal literal valueprecision - precision of the decimal literalscale - scale of the decimal literalLiteral with data type DecimalType with given precision and
scale.public Object getValue()
null is returned. For non-null literal
the returned value is one of the following types based on the literal data type.
Boolean
Byte
Short
Integer
Long
Float
Double
Integer represents the number of days since epoch in UTC
Long represents the microseconds since epoch in UTC
Long represents the microseconds since epoch with no timezone
BigDecimal.Use getDataType() to find the precision and scale
public DataType getDataType()
getValue()public String toString()
toString in class Objectpublic java.util.List<Expression> getChildren()
getChildren in interface Expression