org.springframework.data.relational.core.sql

## Class Conditions

- java.lang.Object
- - org.springframework.data.relational.core.sql.Conditions

    public abstract class Conditions
    extends Object

Factory for common `Condition`s.

Since:
  1.1
Author:
  Mark Paluch, Jens Schauder
See Also:
  `SQL`, `Expressions`, `Functions`

### Method Summary

All Methods Static Methods Concrete Methods
`static Between` `between(Expression columnOrExpression, Expression begin, Expression end)` Creates a `BETWEEN` `Condition`.
`static In` `in(Column column, Select subselect)` Creates a `IN` `clause` for a `subselect`.
`static Condition` `in(Expression columnOrExpression, Collection<? extends Expression> expressions)` Creates a new `In` `Condition` given left and right `Expression`s.
`static In` `in(Expression columnOrExpression, Expression... expressions)` Creates a new `In` `Condition` given left and right `Expression`s.
`static In` `in(Expression columnOrExpression, Expression arg)` Creates a `IN` `clause`.
`static Comparison` `isEqual(Expression leftColumnOrExpression, Expression rightColumnOrExpression)` Creates a `=` (equals) `Condition`.
`static Comparison` `isGreater(Expression leftColumnOrExpression, Expression rightColumnOrExpression)` Creates a `<=` (greater ) `Condition` comparing `left` is greater than `right`.
`static Comparison` `isGreaterOrEqualTo(Expression leftColumnOrExpression, Expression rightColumnOrExpression)` Creates a `<=` (greater or equal to) `Condition` comparing `left` is greater than or equal to `right`.
`static Comparison` `isLess(Expression leftColumnOrExpression, Expression rightColumnOrExpression)` Creates a `<` (less) `Condition` comparing `left` is less than `right`.
`static Comparison` `isLessOrEqualTo(Expression leftColumnOrExpression, Expression rightColumnOrExpression)` Creates a `<=` (less or equal to) `Condition` comparing `left` is less than or equal to `right`.
`static Comparison` `isNotEqual(Expression leftColumnOrExpression, Expression rightColumnOrExpression)` Creates a {@code !
`static IsNull` `isNull(Expression expression)` Creates a `IS NULL` condition.
`static Condition` `just(String sql)` Creates a plain `sql` `Condition`.
`static Like` `like(Expression leftColumnOrExpression, Expression rightColumnOrExpression)` Creates a `LIKE` `Condition`.
`static Condition` `nest(Condition condition)` Creates a nested `Condition` that is enclosed with parentheses.
`static Between` `notBetween(Expression columnOrExpression, Expression begin, Expression end)` Creates a `NOT BETWEEN` `Condition`.
`static In` `notIn(Column column, Select subselect)` Creates a `NOT IN` `clause` for a `subselect`.
`static Condition` `notIn(Expression columnOrExpression, Collection<? extends Expression> expressions)` Creates a new `NOT IN` `Condition` given left and right `Expression`s.
`static In` `notIn(Expression columnOrExpression, Expression... expressions)` Creates a new `NOT IN` `Condition` given left and right `Expression`s.
`static In` `notIn(Expression columnOrExpression, Expression arg)` Creates a `NOT IN` `clause`.
`static Like` `notLike(Expression leftColumnOrExpression, Expression rightColumnOrExpression)` Creates a `NOT LIKE` `Condition`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### just

    public static Condition just(String sql)

Creates a plain `sql` `Condition`.

Parameters:
  `sql` - the SQL, must not be null or empty.
Returns:
  a SQL `Expression`.

#### nest

    public static Condition nest(Condition condition)

Creates a nested `Condition` that is enclosed with parentheses. Useful to combine `AND` and `OR` statements.

Parameters:
  `condition` - the nested condition.
Returns:
  a `NestedCondition`.
Since:
  2.0

#### isNull

    public static IsNull isNull(Expression expression)

Creates a `IS NULL` condition.

Parameters:
  `expression` - the expression to check for nullability, must not be null.
Returns:
  the `IS NULL` condition.

#### isEqual

    public static Comparison isEqual(Expression leftColumnOrExpression,
                                     Expression rightColumnOrExpression)

Creates a `=` (equals) `Condition`.

Parameters:
  `leftColumnOrExpression` - left side of the comparison.
  `rightColumnOrExpression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### isNotEqual

    public static Comparison isNotEqual(Expression leftColumnOrExpression,
                                        Expression rightColumnOrExpression)

Creates a `!=` (not equals) `Condition`.

Parameters:
  `leftColumnOrExpression` - left side of the comparison.
  `rightColumnOrExpression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### between

    public static Between between(Expression columnOrExpression,
                                  Expression begin,
                                  Expression end)

Creates a `BETWEEN` `Condition`.

Parameters:
  `columnOrExpression` - left side of the comparison.
  `begin` - begin value of the comparison.
  `end` - end value of the comparison.
Returns:
  the `Comparison` condition.
Since:
  2.0

#### notBetween

    public static Between notBetween(Expression columnOrExpression,
                                     Expression begin,
                                     Expression end)

Creates a `NOT BETWEEN` `Condition`.

Parameters:
  `columnOrExpression` - left side of the comparison.
  `begin` - begin value of the comparison.
  `end` - end value of the comparison.
Returns:
  the `Comparison` condition.
Since:
  2.0

#### isLess

    public static Comparison isLess(Expression leftColumnOrExpression,
                                    Expression rightColumnOrExpression)

Creates a `<` (less) `Condition` comparing `left` is less than `right`.

Parameters:
  `leftColumnOrExpression` - left side of the comparison.
  `rightColumnOrExpression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### isLessOrEqualTo

    public static Comparison isLessOrEqualTo(Expression leftColumnOrExpression,
                                             Expression rightColumnOrExpression)

Creates a `<=` (less or equal to) `Condition` comparing `left` is less than or equal to `right`.

Parameters:
  `leftColumnOrExpression` - left side of the comparison.
  `rightColumnOrExpression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### isGreater

    public static Comparison isGreater(Expression leftColumnOrExpression,
                                       Expression rightColumnOrExpression)

Creates a `<=` (greater ) `Condition` comparing `left` is greater than `right`.

Parameters:
  `leftColumnOrExpression` - left side of the comparison.
  `rightColumnOrExpression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### isGreaterOrEqualTo

    public static Comparison isGreaterOrEqualTo(Expression leftColumnOrExpression,
                                                Expression rightColumnOrExpression)

Creates a `<=` (greater or equal to) `Condition` comparing `left` is greater than or equal to `right`.

Parameters:
  `leftColumnOrExpression` - left side of the comparison.
  `rightColumnOrExpression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### like

    public static Like like(Expression leftColumnOrExpression,
                            Expression rightColumnOrExpression)

Creates a `LIKE` `Condition`.

Parameters:
  `leftColumnOrExpression` - left side of the comparison.
  `rightColumnOrExpression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### notLike

    public static Like notLike(Expression leftColumnOrExpression,
                               Expression rightColumnOrExpression)

Creates a `NOT LIKE` `Condition`.

Parameters:
  `leftColumnOrExpression` - left side of the comparison.
  `rightColumnOrExpression` - right side of the comparison.
Returns:
  the `Comparison` condition.
Since:
  2.0

#### in

    public static In in(Expression columnOrExpression,
                        Expression arg)

Creates a `IN` `clause`.

Parameters:
  `columnOrExpression` - left side of the comparison.
  `arg` - IN argument.
Returns:
  the `In` condition.

#### in

    public static Condition in(Expression columnOrExpression,
                               Collection<? extends Expression> expressions)

Creates a new `In` `Condition` given left and right `Expression`s.

Parameters:
  `columnOrExpression` - left hand side of the `Condition` must not be null.
  `expressions` - right hand side (collection `Expression`) must not be null.
Returns:
  the `In` `Condition`.

#### in

    public static In in(Expression columnOrExpression,
                        Expression... expressions)

Creates a new `In` `Condition` given left and right `Expression`s.

Parameters:
  `columnOrExpression` - left hand side of the `Condition` must not be null.
  `expressions` - right hand side (collection `Expression`) must not be null.
Returns:
  the `In` `Condition`.

#### in

    public static In in(Column column,
                        Select subselect)

Creates a `IN` `clause` for a `subselect`.

Parameters:
  `column` - the column to compare.
  `subselect` - the subselect.
Returns:
  the `In` condition.

#### notIn

    public static In notIn(Expression columnOrExpression,
                           Expression arg)

Creates a `NOT IN` `clause`.

Parameters:
  `columnOrExpression` - left side of the comparison.
  `arg` - IN argument.
Returns:
  the `In` condition.

#### notIn

    public static Condition notIn(Expression columnOrExpression,
                                  Collection<? extends Expression> expressions)

Creates a new `NOT IN` `Condition` given left and right `Expression`s.

Parameters:
  `columnOrExpression` - left hand side of the `Condition` must not be null.
  `expressions` - right hand side (collection `Expression`) must not be null.
Returns:
  the `In` `Condition`.

#### notIn

    public static In notIn(Expression columnOrExpression,
                           Expression... expressions)

Creates a new `NOT IN` `Condition` given left and right `Expression`s.

Parameters:
  `columnOrExpression` - left hand side of the `Condition` must not be null.
  `expressions` - right hand side (collection `Expression`) must not be null.
Returns:
  the `NOT IN` `Condition`.

#### notIn

    public static In notIn(Column column,
                           Select subselect)

Creates a `NOT IN` `clause` for a `subselect`.

Parameters:
  `column` - the column to compare.
  `subselect` - the subselect.
Returns:
  the `NOT IN` condition.