T
- The Java type of the value wrapped by a Literal
public interface Literal<T>
extends java.io.Serializable
Modifier and Type | Method and Description |
---|---|
java.util.Comparator<T> |
comparator()
Return a
Comparator for values. |
static Literal<java.math.BigDecimal> |
of(java.math.BigDecimal value) |
static Literal<java.lang.Boolean> |
of(boolean value) |
static Literal<java.nio.ByteBuffer> |
of(byte[] value) |
static Literal<java.nio.ByteBuffer> |
of(java.nio.ByteBuffer value) |
static Literal<java.lang.CharSequence> |
of(java.lang.CharSequence value) |
static Literal<java.lang.Double> |
of(double value) |
static Literal<java.lang.Float> |
of(float value) |
static Literal<java.lang.Integer> |
of(int value) |
static Literal<java.lang.Long> |
of(long value) |
static Literal<java.util.UUID> |
of(java.util.UUID value) |
<X> Literal<X> |
to(Type type)
Converts this literal to a literal of the given type.
|
default java.nio.ByteBuffer |
toByteBuffer()
Serializes the value wrapped by this literal to binary using the single-value serialization
format described in the Iceberg table specification.
|
T |
value()
Returns the value wrapped by this literal.
|
static Literal<java.lang.Boolean> of(boolean value)
static Literal<java.lang.Integer> of(int value)
static Literal<java.lang.Long> of(long value)
static Literal<java.lang.Float> of(float value)
static Literal<java.lang.Double> of(double value)
static Literal<java.lang.CharSequence> of(java.lang.CharSequence value)
static Literal<java.util.UUID> of(java.util.UUID value)
static Literal<java.nio.ByteBuffer> of(byte[] value)
static Literal<java.nio.ByteBuffer> of(java.nio.ByteBuffer value)
static Literal<java.math.BigDecimal> of(java.math.BigDecimal value)
T value()
<X> Literal<X> to(Type type)
When a predicate is bound to a concrete data column, literals are converted to match the bound column's type. This conversion process is more narrow than a cast and is only intended for cases where substituting one type is a common mistake (e.g. 34 instead of 34L) or where this API avoids requiring a concrete class (e.g., dates).
If conversion to a target type is not supported, this method returns null.
This method may return Literals.aboveMax()
or Literals.belowMin()
when the target
type is not as wide as the original type. These values indicate that the containing predicate
can be simplified. For example, Integer.MAX_VALUE+1 converted to an int will result in
aboveMax
and can simplify a < Integer.MAX_VALUE+1 to Expressions.alwaysTrue()
X
- The Java type of value the new literal containstype
- A primitive Type
java.util.Comparator<T> comparator()
Comparator
for values.default java.nio.ByteBuffer toByteBuffer()