Interface Criteria

All Known Implementing Classes:
Column, Expression, Parameter

public interface Criteria
Represents a criteria query predicate.

      public ClosableCursor<Product> uncategorizedProducts() {
         return products.recordView(Product.class).queryCriteria(null, columnValue("category", nullValue()));
      }
 
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 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.

      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.
    • 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.