Interface Criteria

All Known Implementing Classes:
Column, Expression, Parameter, QualifiedColumn

public interface Criteria
Represents a criteria query predicate.

      public ClosableCursor<Customer> findCustomerByName(String customerName) {
         return customers.recordView(Customer.class).query(null, columnValue("name", equalTo(customerName)));
      }
 
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    <C> void
    accept(CriteriaVisitor<C> v, C context)
    Accept the visitor with the given context.
    static Expression
    and(Expression... expressions)
    Creates the and of the expressions.
    static Expression
    columnValue(String tableName, String columnName, Condition condition)
    Creates a predicate that tests whether the column value is equal to the given condition.
    static Expression
    columnValue(String columnName, Condition condition)
    Creates a predicate that tests whether the column value is equal to the given condition.
    static Condition
    equalTo(byte[] value)
    Creates a condition that test the examined object is equal to the specified value.
    static <T> Condition
    equalTo(Comparable<T> value)
    Creates a condition that test the examined object is equal to the specified value.
    static <T> Condition
    Creates a condition that test the examined object is greater than the specified value.
    static <T> Condition
    Creates a condition that test the examined object is greater than or equal than the specified value.
    static Condition
    in(byte[]... values)
    Creates a condition that test the examined object is is found within the specified collection.
    static <T> Condition
    in(Comparable<T>... values)
    Creates a condition that test the examined object is is found within the specified collection.
    static <T> Condition
    lessThan(Comparable<T> value)
    Creates a condition that test the examined object is less than the specified value.
    static <T> Condition
    Creates a condition that test the examined object is less than or equal than the specified value.
    static Expression
    not(Expression expression)
    Creates the negation of the predicate.
    static Condition
    notEqualTo(byte[] value)
    Creates a condition that test the examined object is not equal to the specified value.
    static <T> Condition
    Creates a condition that test the examined object is not equal to the specified value.
    static Condition
    notIn(byte[]... values)
    Creates a condition that test the examined object is is not found within the specified collection.
    static <T> Condition
    notIn(Comparable<T>... values)
    Creates a condition that test the examined object is is not found within the specified collection.
    static Condition
    Creates a condition that test the examined object is not null.
    static Condition
    Creates a condition that test the examined object is null.
    static Expression
    or(Expression... expressions)
    Creates the or of the expressions.
  • Method Details

    • accept

      <C> void accept(CriteriaVisitor<C> v, @Nullable C context)
      Accept the visitor with the given context.
      Type Parameters:
      C - Context type.
      Parameters:
      v - Visitor.
      context - Context of visit.
    • columnValue

      static Expression columnValue(String columnName, Condition condition)
      Creates a predicate that tests whether the column value is equal to the given condition.

      This overload should be used with APIs that require simple column names, such as table view queries - see CriteriaQuerySource.query(Transaction, Criteria)

      For example:

      
           columnValue("category", equalTo("toys"))
           columnValue(IgniteNameUtils.quoteIfNeeded("subCategory"), equalTo("puzzle"))
       
      Parameters:
      columnName - Column name must use SQL-parser style notation; e.g.,
      "myColumn", creates a predicate for the column ignores case sensitivity,
      "\"MyColumn\"", creates a predicate for the column with respect to case sensitivity.
      condition - Target condition.
      Returns:
      The created expression instance.
    • columnValue

      static Expression columnValue(String tableName, String columnName, Condition condition)
      Creates a predicate that tests whether the column value is equal to the given condition.

      This overload should be used with APIs that require fully qualified column names, such as continuous query filters - see ContinuousQueryOptions.remoteFilter().

      For example:

      
           columnValue("product", "category", equalTo("toys"))
           columnValue(IgniteNameUtils.quoteIfNeeded("subProduct"), IgniteNameUtils.quoteIfNeeded("subCategory"), equalTo("puzzle"))
       
      Parameters:
      tableName - Table name must use SQL-parser style notation; e.g.,
      "myTable", creates a predicate for the table ignoring case sensitivity,
      "\"MyTable\"", creates a predicate for the table with respect to case sensitivity.
      columnName - Column name must use SQL-parser style notation; e.g.,
      "myColumn", creates a predicate for the column ignores case sensitivity,
      "\"MyColumn\"", creates a predicate for the column with respect to case sensitivity.
      condition - Target condition.
      Returns:
      The created expression instance.
    • not

      static Expression not(Expression expression)
      Creates the negation of the predicate.

      For example:

      
           not(columnValue("category", equalTo("toys")))
       
      Parameters:
      expression - Expression.
      Returns:
      The created negation of the expression.
    • and

      static Expression and(Expression... expressions)
      Creates the and of the expressions.

      For example:

      
           and(columnValue("category", equalTo("toys")), columnValue("quantity", lessThan(20)))
       
      Parameters:
      expressions - Expressions.
      Returns:
      The created and expression instance.
    • or

      static Expression or(Expression... expressions)
      Creates the or of the expressions.

      For example:

      
           or(columnValue("category", equalTo("toys")), columnValue("category", equalTo("games")))
       
      Parameters:
      expressions - Expressions.
      Returns:
      The created or expressions instance.
    • equalTo

      static <T> Condition equalTo(Comparable<T> value)
      Creates a condition that test the examined object is equal to the specified value.

      For example:

      
           columnValue("category", equalTo("toys"))
       
      Type Parameters:
      T - Value type.
      Parameters:
      value - Target value.
    • equalTo

      static Condition equalTo(byte[] value)
      Creates a condition that test the examined object is equal to the specified value.

      For example:

      
           columnValue("password", equalTo("MyPassword".getBytes()))
       
      Parameters:
      value - Target value.
    • notEqualTo

      static <T> Condition notEqualTo(Comparable<T> value)
      Creates a condition that test the examined object is not equal to the specified value.

      For example:

      
           columnValue("category", notEqualTo("toys"))
       
      Type Parameters:
      T - Value type.
      Parameters:
      value - Target value.
    • notEqualTo

      static Condition notEqualTo(byte[] value)
      Creates a condition that test the examined object is not equal to the specified value.

      For example:

      
           columnValue("password", notEqualTo("MyPassword".getBytes()))
       
      Parameters:
      value - Target value.
    • greaterThan

      static <T> Condition greaterThan(Comparable<T> value)
      Creates a condition that test the examined object is greater than the specified value.

      For example:

      
           columnValue("age", greaterThan(35))
       
      Type Parameters:
      T - Value type.
      Parameters:
      value - Target value.
    • greaterThanOrEqualTo

      static <T> Condition greaterThanOrEqualTo(Comparable<T> value)
      Creates a condition that test the examined object is greater than or equal than the specified value.

      For example:

      
           columnValue("age", greaterThanOrEqualTo(35))
       
      Type Parameters:
      T - Value type.
      Parameters:
      value - Target value.
    • lessThan

      static <T> Condition lessThan(Comparable<T> value)
      Creates a condition that test the examined object is less than the specified value.

      For example:

      
           columnValue("age", lessThan(35))
       
      Type Parameters:
      T - Value type.
      Parameters:
      value - Target value.
    • lessThanOrEqualTo

      static <T> Condition lessThanOrEqualTo(Comparable<T> value)
      Creates a condition that test the examined object is less than or equal than the specified value.

      For example:

      
           columnValue("age", lessThanOrEqualTo(35))
       
      Type Parameters:
      T - Value type.
      Parameters:
      value - Target value.
    • nullValue

      static Condition nullValue()
      Creates a condition that test the examined object is null.

      For example:

      
           columnValue("category", nullValue())
       
    • notNullValue

      static Condition notNullValue()
      Creates a condition that test the examined object is not null.

      For example:

      
           columnValue("category", notNullValue())
       
    • in

      static <T> Condition in(Comparable<T>... values)
      Creates a condition that test the examined object is is found within the specified collection.

      For example:

      
           columnValue("category", in("toys", "games"))
       
      Type Parameters:
      T - Values type.
      Parameters:
      values - The collection in which matching items must be found.
    • in

      static Condition in(byte[]... values)
      Creates a condition that test the examined object is is found within the specified collection.

      For example:

      
           columnValue("password", in("MyPassword".getBytes(), "MyOtherPassword".getBytes()))
       
      Parameters:
      values - The collection in which matching items must be found.
    • notIn

      static <T> Condition notIn(Comparable<T>... values)
      Creates a condition that test the examined object is is not found within the specified collection.

      For example:

      
           columnValue("category", notIn("toys", "games"))
       
      Type Parameters:
      T - Values type.
      Parameters:
      values - The collection in which matching items must be not found.
    • notIn

      static Condition notIn(byte[]... values)
      Creates a condition that test the examined object is is not found within the specified collection.

      For example:

      
           columnValue("password", notIn("MyPassword".getBytes(), "MyOtherPassword".getBytes()))
       
      Parameters:
      values - The collection in which matching items must be not found.