Enum Class RsqlOperator

java.lang.Object
java.lang.Enum<RsqlOperator>
in.co.akshitbansal.springwebquery.operator.RsqlOperator
All Implemented Interfaces:
Serializable, Comparable<RsqlOperator>, Constable

public enum RsqlOperator extends Enum<RsqlOperator>
Enumeration of supported RSQL comparison operators.

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 EntityValidationRSQLVisitor to enforce these constraints at runtime.

Example usage:


 @RsqlFilterable({RsqlOperator.EQUAL, RsqlOperator.IN})
 private String status;
 
See Also:
  • Enum Constant Details

    • EQUAL

      public static final RsqlOperator 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

      public static final RsqlOperator NOT_EQUAL
      Inequality operator (!=).

      Example: status!="DELETED"

      SQL Equivalent: status <> 'DELETED'

    • GREATER_THAN

      public static final RsqlOperator GREATER_THAN
      Greater than operator (> or =gt=).

      Example: age>18 or age=gt=18

      SQL Equivalent: age > 18

    • GREATER_THAN_OR_EQUAL

      public static final RsqlOperator GREATER_THAN_OR_EQUAL
      Greater than or equal to operator (>= or =ge=).

      Example: price>=100.0 or price=ge=100.0

      SQL Equivalent: price >= 100.0

    • LESS_THAN

      public static final RsqlOperator LESS_THAN
      Less than operator (< or =lt=).

      Example: score<50 or score=lt=50

      SQL Equivalent: score < 50

    • LESS_THAN_OR_EQUAL

      public static final RsqlOperator LESS_THAN_OR_EQUAL
      Less than or equal to operator (<= or =le=).

      Example: count<=10 or count=le=10

      SQL Equivalent: count <= 10

    • IN

      public static final RsqlOperator IN
      Set membership operator (=in=). Expects a list of values.

      Example: role=in=(ADMIN,USER)

      SQL Equivalent: role IN ('ADMIN', 'USER')

    • NOT_IN

      public static final RsqlOperator 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

      public static final RsqlOperator IS_NULL
      Null check operator (=null=, =isnull=, or =na=).

      Example: middleName=null= or middleName=null=true or middleName=isnull=true or middleName=na=true

      SQL Equivalent: middleName IS NULL

    • NOT_NULL

      public static final RsqlOperator NOT_NULL
      Non-null check operator (=notnull=, =isnotnull=, or =nn=).

      Example: email=notnull= or email=notnull=true or email=isnotnull=true or email=nn=true

      SQL Equivalent: email IS NOT NULL

    • LIKE

      public static final RsqlOperator LIKE
      Like operator (=like= or =ke=).

      Example: description=like="spring"

      SQL Equivalent: description LIKE '%spring%'

    • NOT_LIKE

      public static final RsqlOperator NOT_LIKE
      Not like operator (=notlike= or =nk=).

      Example: title=notlike="Draft"

      SQL Equivalent: title NOT LIKE '%Draft%'

    • IGNORE_CASE

      public static final RsqlOperator IGNORE_CASE
      Case-insensitive equality operator (=icase= or =ic=).

      Example: city=icase=london

      SQL Equivalent: LOWER(city) = LOWER('london')

    • IGNORE_CASE_LIKE

      public static final RsqlOperator 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

      public static final RsqlOperator 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

      public static final RsqlOperator 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

      public static final RsqlOperator 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

      public static RsqlOperator[] 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

      public static RsqlOperator valueOf(String name)
      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 name
      NullPointerException - if the argument is null