Enum Class RsqlOperator
- All Implemented Interfaces:
Serializable,Comparable<RsqlOperator>,Constable
This enum provides a type-safe wrapper around the built-in
RSQLOperators supplied by the RSQL library.
Each enum constant maps directly to a corresponding ComparisonOperator
instance and represents a single logical comparison operation supported by RSQL.
The primary purpose of this enum is to:
- Expose RSQL operators in a form that can be safely used in Java annotations
- Allow fine-grained control over which operators are permitted for a given entity field
- Decouple application code from direct usage of
RSQLOperators
RsqlOperator is typically used in conjunction with
RsqlFilterable to declare the set of allowed operators on an entity field,
and with ValidationRSQLVisitor to enforce these constraints at runtime.
Example usage:
@RsqlFilterable(operators = {RsqlOperator.EQUAL, RsqlOperator.IN})
private String status;
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRange operator (=between=or=bt=).Strict equality operator (==).Greater than operator (>or=gt=).Greater than or equal to operator (>=or=ge=).Case-insensitive equality operator (=icase=or=ic=).Case-insensitive like operator (=ilike=or=ik=).Case-insensitive not like operator (=inotlike=or=ni=).Set membership operator (=in=).Null check operator (=null=,=isnull=, or=na=).Less than operator (<or=lt=).Less than or equal to operator (<=or=le=).Like operator (=like=or=ke=).Not between operator (=notbetween=or=nb=).Inequality operator (!=).Set non-membership operator (=out=).Not like operator (=notlike=or=nk=).Non-null check operator (=notnull=,=isnotnull=, or=nn=). -
Method Summary
Modifier and TypeMethodDescriptionstatic RsqlOperatorReturns the enum constant of this class with the specified name.static RsqlOperator[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
EQUAL
Strict equality operator (==).Note: This operator enforces strict equality. Wildcards (e.g.,
*) are not supported and will be treated as literal characters.Example:
name=="John Doe"SQL Equivalent:
name = 'John Doe' -
NOT_EQUAL
Inequality operator (!=).Example:
status!="DELETED"SQL Equivalent:
status <> 'DELETED' -
GREATER_THAN
Greater than operator (>or=gt=).Example:
age>18orage=gt=18SQL Equivalent:
age > 18 -
GREATER_THAN_OR_EQUAL
Greater than or equal to operator (>=or=ge=).Example:
price>=100.0orprice=ge=100.0SQL Equivalent:
price >= 100.0 -
LESS_THAN
Less than operator (<or=lt=).Example:
score<50orscore=lt=50SQL Equivalent:
score < 50 -
LESS_THAN_OR_EQUAL
Less than or equal to operator (<=or=le=).Example:
count<=10orcount=le=10SQL Equivalent:
count <= 10 -
IN
Set membership operator (=in=). Expects a list of values.Example:
role=in=(ADMIN,USER)SQL Equivalent:
role IN ('ADMIN', 'USER') -
NOT_IN
Set non-membership operator (=out=). Expects a list of values.Example:
department=out=(HR,FINANCE)SQL Equivalent:
department NOT IN ('HR', 'FINANCE') -
IS_NULL
Null check operator (=null=,=isnull=, or=na=).Example:
middleName=null=ormiddleName=null=trueormiddleName=isnull=trueormiddleName=na=trueSQL Equivalent:
middleName IS NULL -
NOT_NULL
Non-null check operator (=notnull=,=isnotnull=, or=nn=).Example:
email=notnull=oremail=notnull=trueoremail=isnotnull=trueoremail=nn=trueSQL Equivalent:
email IS NOT NULL -
LIKE
Like operator (=like=or=ke=).Example:
description=like="spring"SQL Equivalent:
description LIKE '%spring%' -
NOT_LIKE
Not like operator (=notlike=or=nk=).Example:
title=notlike="Draft"SQL Equivalent:
title NOT LIKE '%Draft%' -
IGNORE_CASE
Case-insensitive equality operator (=icase=or=ic=).Example:
city=icase=londonSQL Equivalent:
LOWER(city) = LOWER('london') -
IGNORE_CASE_LIKE
Case-insensitive like operator (=ilike=or=ik=).Example:
username=ilike="admin"SQL Equivalent:
LOWER(username) LIKE LOWER('%admin%') -
IGNORE_CASE_NOT_LIKE
Case-insensitive not like operator (=inotlike=or=ni=).Example:
tag=inotlike="test"SQL Equivalent:
LOWER(tag) NOT LIKE LOWER('%test%') -
BETWEEN
Range operator (=between=or=bt=). Expects exactly two values.Example:
createdAt=between=(2023-01-01,2023-12-31)SQL Equivalent:
createdAt BETWEEN '2023-01-01' AND '2023-12-31' -
NOT_BETWEEN
Not between operator (=notbetween=or=nb=). Expects exactly two values.Example:
age=notbetween=(18,65)SQL Equivalent:
age NOT BETWEEN 18 AND 65
-
-
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
-