Class ConditionValues

java.lang.Object
com.ultikits.ultitools.interfaces.impl.data.ConditionValues

@Internal public final class ConditionValues extends Object
The one rule every storage backend applies to the value of a WhereCondition before it compares anything (#815, #696): a null value and a non-finite number (an infinite or NaN double or float) are refused with a DataAccessException carrying ErrorCode.DATA_ENTITY_INVALID.

Neither has a comparison meaning the three backends share. Before 6.4.0 SQLite and MySQL bound such a value as it was (a null EQUAL matched no row, a null INCLUDE matched the text null, a NaN matched no row), while JSON threw a raw NullPointerException or Gson's IllegalArgumentException. Refusing both on every backend with one typed exception makes the caller's mistake visible instead of letting the same call answer differently per backend.

The single exception is the documented meaning of a null value under EQUAL in DataOperator#updateIf (IS NULL, #640). That caller checks it before calling this class and never passes such a condition here.

Since:
6.4.0
  • Constructor Details

    • ConditionValues

      private ConditionValues()
  • Method Details

    • requireComparable

      public static void requireComparable(WhereCondition condition, String store)
      Refuses a condition whose value cannot be compared on every backend.
      Parameters:
      condition - a non-empty condition
      store - the table or store name, for the message
      Throws:
      DataAccessException - (ErrorCode.DATA_ENTITY_INVALID) if the value is null, or a Double or Float that is infinite or NaN
    • requireFinite

      public static void requireFinite(WhereCondition condition, String store)
      Refuses a non-finite number only; a null value is left to the caller.
      Parameters:
      condition - a non-empty condition
      store - the table or store name, for the message
      Throws:
      DataAccessException - (ErrorCode.DATA_ENTITY_INVALID) if the value is a Double or Float that is infinite or NaN
    • isNonFinite

      private static boolean isNonFinite(Object value)