Enum Class ScalarType

java.lang.Object
java.lang.Enum<ScalarType>
com.darkcollective.relix.symbol.ScalarType
All Implemented Interfaces:
Type, Serializable, Comparable<ScalarType>, Constable

public enum ScalarType extends Enum<ScalarType> implements Type
The scalar-value type lattice used for column types, function parameter types, and function return types.

A ScalarType is the leaf case of the Type hierarchy; the nested cases are StructType and ArrayType.

ANY is the top type — it is compatible with every other type and serves as the default when no more specific type has been declared or inferred. This allows symbols to be registered with minimal ceremony: a relation column typed ANY will accept values of any kind at analysis time.

Type inference for inline (markdown) relations assigns NUMBER to a column when every non-header cell in that column parses as a numeric literal; otherwise STRING is used.

  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Unconstrained — compatible with all other types.
    Boolean data; corresponds to the literals true and false.
    A calendar day with no zone, e.g.
    An exact elapsed span — seconds and nanoseconds (backed by java.time.Duration).
    Numeric data; corresponds to integer or decimal numeric literals.
    Textual data; corresponds to string literals enclosed in double quotes.
    A wall-clock time of day with no zone, e.g.
    An absolute point on the timeline, UTC-normalised (backed by java.time.Instant).
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the compact type code used in the IR report and in machine-readable (JSON) output: Number, String, Boolean, ?=any, and the temporal codes D=date, T=time, TS=timestamp, DUR=duration.
    Returns the lower-cased type name, e.g. "number".
    static ScalarType
    Returns the ScalarType constant whose name matches name, ignoring case.
    static ScalarType
    Returns the enum constant of this class with the specified name.
    static ScalarType[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • ANY

      public static final ScalarType ANY
      Unconstrained — compatible with all other types. Default when no type annotation is present, and the dynamic document type for schema-on-read sources (a value may be a scalar, struct, or array at runtime).
    • STRING

      public static final ScalarType STRING
      Textual data; corresponds to string literals enclosed in double quotes.
    • NUMBER

      public static final ScalarType NUMBER
      Numeric data; corresponds to integer or decimal numeric literals.
    • BOOLEAN

      public static final ScalarType BOOLEAN
      Boolean data; corresponds to the literals true and false.
    • DATE

      public static final ScalarType DATE
      A calendar day with no zone, e.g. 2026-06-15 (backed by java.time.LocalDate).
    • TIME

      public static final ScalarType TIME
      A wall-clock time of day with no zone, e.g. 13:40:00 (backed by java.time.LocalTime).
    • TIMESTAMP

      public static final ScalarType TIMESTAMP
      An absolute point on the timeline, UTC-normalised (backed by java.time.Instant).
    • DURATION

      public static final ScalarType DURATION
      An exact elapsed span — seconds and nanoseconds (backed by java.time.Duration).
  • Method Details

    • values

      public static ScalarType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ScalarType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • display

      public String display()
      Returns the lower-cased type name, e.g. "number".
      Specified by:
      display in interface Type
      Returns:
      the lower-cased type name, e.g. "number"
    • code

      public String code()
      Returns the compact type code used in the IR report and in machine-readable (JSON) output: Number, String, Boolean, ?=any, and the temporal codes D=date, T=time, TS=timestamp, DUR=duration.
      Specified by:
      code in interface Type
      Returns:
      the type code (one character for the scalar leaves, a short multi-letter token for the temporal types)
    • fromString

      public static ScalarType fromString(String name)
      Returns the ScalarType constant whose name matches name, ignoring case.
      Parameters:
      name - the type name, e.g. "string", "NUMBER"
      Returns:
      the matching constant
      Throws:
      IllegalArgumentException - if no constant matches