Class VariantBooleans

java.lang.Object
dev.frostlake.values.VariantBooleans

public final class VariantBooleans extends Object
A VARIANT converted to BOOLEAN — by ::BOOLEAN, CAST or TO_BOOLEAN — on the account's terms: it converts only when it holds a boolean. A JSON boolean is itself, a JSON null (or an absent value) is NULL, and a JSON string is read the way TO_BOOLEAN reads text ('yes', 'F', '1', trimmed, any case). Every other value fails the row with Failed to cast variant value <text> to BOOLEAN, a number included — though a SQL NUMBER converts, a variant one does not — and so does a string that is no boolean spelling, quoted as the variant holds it (all live-verified).
  • Method Details

    • convert

      public static Boolean convert(VariantValue value)
      Parameters:
      value - the variant
      Returns:
      its boolean, or null for a JSON null