Enum Class ComparisonOperator
java.lang.Object
java.lang.Enum<ComparisonOperator>
org.gcube.informationsystem.resourceregistry.queries.operators.ComparisonOperator
- All Implemented Interfaces:
Serializable,Comparable<ComparisonOperator>,Constable
Defines OrientDB comparison and collection operators used in JSON queries.
- Author:
- Luca Frosini (ISTI - CNR)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionBetween operator.Collection contains operator.Collection contains all operator.Collection contains any operator.Map contains key operator.Contains text operator.Map contains value operator.Equal operator.Greater than operator.Greater than or equal operator.Collection membership operator.Is operator for NULL checks.Property is defined operator.Property is not defined operator.Like wildcard operator.Less than operator.Less than or equal operator.Regex matches operator.Not equal operator. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.gcube.informationsystem.types.PropertyTypeName.BaseTypeGroupThe allowed value type group for operands.protected final StringThe underlying OrientDB database operator string.protected final StringThe human-readable description of the operator.protected final intThe number of operands accepted by this operator.protected final StringThe unique query operator key string. -
Method Summary
Modifier and TypeMethodDescriptionaddCondition(String... operands) Builds a SQL condition from raw string operands.addCondition(org.gcube.com.fasterxml.jackson.databind.JsonNode jn, String fieldNamePrefix) Builds a SQL condition from a JSON query node (subclass hook).Returns the underlying OrientDB database operator string.Returns the human-readable description of the operator.static ComparisonOperatorgetOperator(String key) Resolves aComparisonOperatorby its key.Returns the unique query operator key string.Returns the set of all registered operator keys.static StringgetValue(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) Formats and escapes a JSON node value as a SQL-safe literal.static ComparisonOperatorReturns the enum constant of this class with the specified name.static ComparisonOperator[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
EQ
Equal operator. -
GT
Greater than operator. -
GTE
Greater than or equal operator. -
LT
Less than operator. -
LTE
Less than or equal operator. -
NE
Not equal operator. -
BETWEEN
Between operator. -
IS
Is operator for NULL checks. -
LIKE
Like wildcard operator. -
CONTAINS_TEXT
Contains text operator. -
MATCHES
Regex matches operator. -
IN
Collection membership operator. -
CONTAINS
Collection contains operator. -
CONTAINS_ALL
Collection contains all operator. -
CONTAINS_ANY
Collection contains any operator. -
CONTAINS_KEY
Map contains key operator. -
CONTAINS_VALUE
Map contains value operator. -
IS_DEFINED
Property is defined operator. -
IS_NOT_DEFINED
Property is not defined operator.
-
-
Field Details
-
operatorKey
The unique query operator key string. -
numberOfOperand
protected final int numberOfOperandThe number of operands accepted by this operator. -
dbOperator
The underlying OrientDB database operator string. -
allowed
protected final org.gcube.informationsystem.types.PropertyTypeName.BaseTypeGroup allowedThe allowed value type group for operands. -
description
The human-readable description of the operator.
-
-
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
-
getOperatorKey
Returns the unique query operator key string.- Returns:
- the operator key string
-
getDbOperator
Returns the underlying OrientDB database operator string.- Returns:
- the OrientDB database operator string
-
getDescription
Returns the human-readable description of the operator.- Returns:
- the description string
-
getOperators
Returns the set of all registered operator keys.- Returns:
- the set of operator keys
-
getOperator
Resolves aComparisonOperatorby its key.- Parameters:
key- the operator key- Returns:
- the resolved
ComparisonOperator, or null
-
addCondition
Builds a SQL condition from raw string operands.- Parameters:
operands- the operands- Returns:
- a string buffer containing the formatted SQL condition
-
getValue
Formats and escapes a JSON node value as a SQL-safe literal.Array nodes are formatted as an OrientDB collection literal (e.g.
["a", "b"]), each element individually escaped. Scalar nodes are formatted as a single literal.- Parameters:
jsonNode- the JSON value node- Returns:
- the escaped SQL literal string
-
addCondition
public StringBuffer addCondition(org.gcube.com.fasterxml.jackson.databind.JsonNode jn, String fieldNamePrefix) Builds a SQL condition from a JSON query node (subclass hook).- Parameters:
jn- the JSON query nodefieldNamePrefix- the parent field name prefix- Returns:
- the formatted SQL condition
-