Package dev.vortex.api.proto
Class Scalars
java.lang.Object
dev.vortex.api.proto.Scalars
Factory class for creating Vortex scalar values with their associated data types.
This class provides static factory methods to create ScalarProtos.Scalar instances
for all supported Vortex data types. Each scalar consists of a value and its corresponding
data type definition. The class supports both nullable and non-nullable variants for most types.
Factory methods follow a consistent naming pattern:
typeName(value)- Creates a non-nullable scalar with the given valuenullTypeName()- Creates a nullable scalar with a null value
Example usage:
// Create a non-nullable integer
ScalarProtos.Scalar intScalar = Scalars.int32(42);
// Create a nullable string with null value
ScalarProtos.Scalar nullString = Scalars.nullString();
// Create a string with value
ScalarProtos.Scalar stringScalar = Scalars.string("hello");
-
Method Summary
Modifier and TypeMethodDescriptionstatic ScalarProtos.Scalarbool(boolean value) Creates a non-nullable boolean scalar with the specified value.static ScalarProtos.Scalarbytes(byte[] value) static ScalarProtos.ScalardateDays(int value) static ScalarProtos.ScalardateMillis(long value) static ScalarProtos.Scalardecimal(BigDecimal decimal, int precision, int scale) Creates a non-nullable decimal scalar with the specified value, precision, and scale.static ScalarProtos.Scalarfloat32(float value) static ScalarProtos.Scalarfloat64(double value) static ScalarProtos.Scalarint16(short value) static ScalarProtos.Scalarint32(int value) Creates a non-nullable 32-bit integer scalar with the specified value.static ScalarProtos.Scalarint64(long value) static ScalarProtos.Scalarint8(byte value) static ScalarProtos.ScalarnullBool()Creates a nullable boolean scalar with a null value.static ScalarProtos.Scalarstatic ScalarProtos.Scalarstatic ScalarProtos.Scalarstatic ScalarProtos.ScalarnullDecimal(int precision, int scale) static ScalarProtos.Scalarstatic ScalarProtos.Scalarstatic ScalarProtos.Scalarstatic ScalarProtos.Scalarstatic ScalarProtos.Scalarstatic ScalarProtos.ScalarnullInt8()static ScalarProtos.ScalarnullNull()Creates a null scalar value.static ScalarProtos.Scalarstatic ScalarProtos.Scalarstatic ScalarProtos.Scalarstatic ScalarProtos.Scalarstatic ScalarProtos.Scalarstatic ScalarProtos.ScalarnullTimestampMicros(Optional<String> timeZone) static ScalarProtos.ScalarnullTimestampMillis(Optional<String> timeZone) static ScalarProtos.ScalarnullTimestampNanos(Optional<String> timeZone) static ScalarProtos.ScalarCreates a non-nullable string scalar with the specified value.static ScalarProtos.ScalartimeMicros(long value) static ScalarProtos.ScalartimeMillis(int value) static ScalarProtos.ScalartimeNanos(long value) static ScalarProtos.ScalartimeSeconds(int value) static ScalarProtos.ScalartimestampMicros(long value, Optional<String> timeZone) static ScalarProtos.ScalartimestampMillis(long value, Optional<String> timeZone) Creates a non-nullable timestamp scalar with millisecond precision.static ScalarProtos.ScalartimestampNanos(long value, Optional<String> timeZone)
-
Method Details
-
nullNull
Creates a null scalar value.This represents a scalar that is explicitly null with null data type.
- Returns:
- a
ScalarProtos.Scalarrepresenting a null value
-
bool
Creates a non-nullable boolean scalar with the specified value.- Parameters:
value- the boolean value- Returns:
- a
ScalarProtos.Scalarcontaining the boolean value
-
nullBool
Creates a nullable boolean scalar with a null value.- Returns:
- a
ScalarProtos.Scalarrepresenting a null boolean
-
int8
-
nullInt8
-
int16
-
nullInt16
-
int32
Creates a non-nullable 32-bit integer scalar with the specified value.- Parameters:
value- the integer value- Returns:
- a
ScalarProtos.Scalarcontaining the 32-bit integer value
-
nullInt32
-
int64
-
nullInt64
-
float32
-
nullFloat32
-
float64
-
nullFloat64
-
string
Creates a non-nullable string scalar with the specified value.- Parameters:
value- the string value- Returns:
- a
ScalarProtos.Scalarcontaining the string value
-
nullString
-
decimal
Creates a non-nullable decimal scalar with the specified value, precision, and scale.The decimal value is converted to little-endian byte representation for storage.
- Parameters:
decimal- the decimal value as aBigDecimalprecision- the total number of digits in the decimalscale- the number of digits after the decimal point- Returns:
- a
ScalarProtos.Scalarcontaining the decimal value
-
nullDecimal
-
bytes
-
nullBytes
-
dateDays
-
nullDateDays
-
dateMillis
-
nullDateMillis
-
timeSeconds
-
nullTimeSeconds
-
timeMillis
-
nullTimeMillis
-
timeMicros
-
nullTimeMicros
-
timeNanos
-
nullTimeNanos
-
timestampMillis
Creates a non-nullable timestamp scalar with millisecond precision.The timestamp represents the number of milliseconds since Unix epoch (1970-01-01 00:00:00 UTC), optionally adjusted for the specified time zone.
- Parameters:
value- the timestamp value in milliseconds since Unix epochtimeZone- optional time zone identifier (e.g., "UTC", "America/New_York")- Returns:
- a
ScalarProtos.Scalarcontaining the timestamp value
-
nullTimestampMillis
-
timestampMicros
-
nullTimestampMicros
-
timestampNanos
-
nullTimestampNanos
-