Enum Class Comparison
- All Implemented Interfaces:
Serializable,Comparable<Comparison>,java.lang.constant.Constable
WhereCondition compares a stored column with its value.
The comparison means the same in getAll, exist, page, del and
updateIf of the SQLite, MySQL and JSON data operators, and no table is changed to make it
hold. DataOperator#getLike and Query#like are separate pattern operators and do not
use this enum.
- Version:
- 1.0.0
- Author:
- wisdomme
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe stored text ends with the value, matched literally as text with the same rules asINCLUDE.The stored value equals the value.The stored value is greater than the value.The stored text contains the value.The stored value is less than the value.The stored text starts with the value, matched literally as text with the same rules asINCLUDE. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComparisonReturns the enum constant of this class with the specified name.static Comparison[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
EQUAL
The stored value equals the value. Its meaning is unchanged; inDataOperator#updateIfanullvalue means the column is unset (IS NULL). -
GREATER
The stored value is greater than the value.On a
byte,short,int,long,floatordoublefield, or its wrapper, the two are compared as numbers of that type. Pass the value as a number of that type (for example10, not"10"): a text value is not converted, and MySQL compares it with a default text column as text, so"10"sorts below"2". On SQLite the comparison holds also in a column left on the defaultVARCHAR(255)type, with 64-bit integer precision, and compares a stored value the way it reads back: afloatsuch as0.1fis neither greater nor less than the same value, and adoublethat needs 16 or 17 significant digits is stored and compared with 15. A number that agrees with a storedfloatto 15 significant digits but differs after them compares as equal to it; pass afloatvalue for afloatfield. That holds for a value that is a finite number; an infinite value, a number beyond the range of adoubleand text are compared as bound, and a NaN value matches no row. On MySQL such a default text column is compared the way MySQL compares text with a number, in double precision, so whole numbers beyond plus or minus 9,007,199,254,740,992 (2^53) compare approximately; declare the column with a numerictype(for exampleBIGINT) for exact results there. On JSON the values are compared asdouble, also approximate beyond plus or minus 9,007,199,254,740,992, and an infinite or NaN value throwsIllegalArgumentException, because it cannot be written as JSON. A field of any other type is compared as the database compares the stored text. -
LESS
The stored value is less than the value. It follows the same rules asGREATER: typed numeric comparison on numeric fields, for a value passed as a number of the field's type (on SQLite also in default text columns, with 64-bit integer precision and as the stored value reads back; on MySQL default text columns and on JSON in double precision, approximate beyond plus or minus 9,007,199,254,740,992), and the database's text comparison otherwise. -
INCLUDE
The stored text contains the value.The value is matched literally as text, on SQLite, MySQL and JSON alike: percent, underscore, exclamation mark and backslash are ordinary characters, not wildcards or escapes. Letter case and accents follow the backend: SQLite ignores the case of ASCII letters only; MySQL compares under the
utf8mb3_general_cicollation of the tables the framework creates, which ignores case and accents, soematchesé; JSON compares exactly. -
STARTSWITH
The stored text starts with the value, matched literally as text with the same rules asINCLUDE. -
ENDSWITH
The stored text ends with the value, matched literally as text with the same rules asINCLUDE.
-
-
Constructor Details
-
Comparison
private Comparison()
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-