Package dev.frostlake.values
Class ExactValues
java.lang.Object
dev.frostlake.values.ExactValues
The ONE carrier an exact NUMBER(p, s) column holds, whatever path a value arrives by. A scale-0
column holds a
Long for every whole value that fits one and a scale-0 BigDecimal
beyond the long range; a scaled column holds a BigDecimal at exactly its scale, rounded
HALF_UP from whatever was written. Before this, the same column held a Long from an INSERT of a
literal beside a BigDecimal from an UPDATE or a VARIANT cast, and every raw equals or
Comparable seam — a DISTINCT set, a join key, a MIN / MAX fast path — could meet one number
in two classes. The FLOAT family has the same rule in ApproximateValues.-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisCarrier(Object value, NumericType type) Whether a cell already is the carrier its column holds — the check every write makes before touching a row.static Objectwritten(Object value, NumericType type) The value as its column stores it.
-
Method Details
-
written
The value as its column stores it.- Parameters:
value- the value written, or nulltype- the column's numeric type- Returns:
- the carrier — a Long or a BigDecimal — or the value itself when it is not a number the column can hold (a NULL, a non-numeric, a NaN) or the column is approximate
-
isCarrier
Whether a cell already is the carrier its column holds — the check every write makes before touching a row.- Parameters:
value- the cell, not nulltype- the column's exact numeric type- Returns:
- true when the cell can be stored as it is
-