Class ConditionValues
java.lang.Object
com.ultikits.ultitools.interfaces.impl.data.ConditionValues
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanisNonFinite(Object value) static voidrequireComparable(WhereCondition condition, String store) Refuses a condition whose value cannot be compared on every backend.static voidrequireFinite(WhereCondition condition, String store) Refuses a non-finite number only; anullvalue is left to the caller.
-
Constructor Details
-
ConditionValues
private ConditionValues()
-
-
Method Details
-
requireComparable
Refuses a condition whose value cannot be compared on every backend.- Parameters:
condition- a non-empty conditionstore- the table or store name, for the message- Throws:
DataAccessException- (ErrorCode.DATA_ENTITY_INVALID) if the value isnull, or aDoubleorFloatthat is infinite or NaN
-
requireFinite
Refuses a non-finite number only; anullvalue is left to the caller.- Parameters:
condition- a non-empty conditionstore- the table or store name, for the message- Throws:
DataAccessException- (ErrorCode.DATA_ENTITY_INVALID) if the value is aDoubleorFloatthat is infinite or NaN
-
isNonFinite
-