public class Where extends Object implements StatementPopulator
StatementPopulator.Empty
Constructor and Description |
---|
Where()
Creates an object with no filters.
|
Where(String columnName,
Operator operator,
BigDecimal value)
Create a new instance of a
Where object
containing one predicate. |
Where(String columnName,
Operator operator,
Boolean value)
Create a new instance of a
Where object
containing one predicate. |
Where(String columnName,
Operator operator,
Instant value)
Create a new instance of a
Where object
containing one predicate. |
Where(String columnName,
Operator operator,
Long value)
Create a new instance of a
Where object
containing one predicate. |
Where(String columnName,
Operator operator,
String value)
Create a new instance of a
Where object
containing one predicate. |
Where(String columnName,
Operator operator,
T value,
GenericColumn<T> column)
Create a new instance of a
Where object
containing one predicate. |
Where(Where subWhere)
Creates a new
Where instance that is grouped,
that is, when the SQL where clause is generated, whatever is
inside the passed where instance will be wrapped inside
parentheses. |
Modifier and Type | Method and Description |
---|---|
Where |
and(String columnName,
Operator operator,
BigDecimal value)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical and.
|
Where |
and(String columnName,
Operator operator,
Boolean value)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical and.
|
Where |
and(String columnName,
Operator operator,
Instant value)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical and.
|
Where |
and(String columnName,
Operator operator,
Long value)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical and.
|
Where |
and(String columnName,
Operator operator,
String value)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical and.
|
<T> Where |
and(String columnName,
Operator operator,
T value,
GenericColumn<T> column)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical and.
|
Where |
and(Where subWhere)
Add a new predicate to the existing object by connecting the
existing predicates to the passed argument with a logical and
operation.
|
static Where |
inBigDecimal(String columnName,
List<BigDecimal> elements)
Generates an
IN clause applying to the specified column and
including the passed list of numbers. |
static <T> Where |
inColumn(String columnName,
GenericColumn<T> column,
List<T> elements)
Generates an
IN clause applying to the specified column and
including the passed list of elements. |
static Where |
inInstant(String columnName,
List<Instant> elements)
Generates an
IN clause applying to the specified column and
including the passed list of dates. |
static Where |
inLong(String columnName,
List<Long> elements)
Generates an
IN clause applying to the specified column and
including the passed list of numbers. |
static Where |
inString(String columnName,
List<String> elements)
Generates an
IN clause applying to the specified column and
including the passed list of strings. |
static Where |
isNotNull(String columnName)
Creates a new object with a single predicate testing whether
a column is not null.
|
static Where |
isNull(String columnName)
Creates a new object with a single predicate testing whether
a column is null.
|
static Where |
notInBigDecimal(String columnName,
List<BigDecimal> elements)
Generates a
NOT IN clause applying to the specified column and
excluding the passed list of numbers. |
static <T> Where |
notInColumn(String columnName,
GenericColumn<T> column,
List<T> elements)
Generates a
NOT IN clause applying to the specified column and
excluding the passed list of elements. |
static Where |
notInInstant(String columnName,
List<Instant> elements)
Generates a
NOT IN clause applying to the specified column and
excluding the passed list of dates. |
static Where |
notInLong(String columnName,
List<Long> elements)
Generates a
NOT IN clause applying to the specified column and
excluding the passed list of numbers. |
static Where |
notInString(String columnName,
List<String> elements)
Generates a
NOT IN clause applying to the specified column and
excluding the passed list of strings. |
Where |
or(String columnName,
Operator operator,
BigDecimal value)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical or.
|
Where |
or(String columnName,
Operator operator,
Boolean value)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical or.
|
Where |
or(String columnName,
Operator operator,
Instant value)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical or.
|
Where |
or(String columnName,
Operator operator,
Long value)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical or.
|
Where |
or(String columnName,
Operator operator,
String value)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical or.
|
<T> Where |
or(String columnName,
Operator operator,
T value,
GenericColumn<T> column)
Add a new predicate to the existing object by connecting the
existing predicates to the new one with a logical or.
|
Where |
or(Where subWhere)
Add a new predicate to the existing object by connecting the
existing predicates to the passed argument with a logical or
operation.
|
void |
populate(PreparedStatement preparedStatement) |
String |
render()
The SQL that makes up the where clause this object represents.
|
String |
renderNoPrefix() |
static Where |
where()
Factory method equivalent to
new Where() . |
static Where |
where(String columnName,
Operator operator,
BigDecimal value)
Factory method equivalent to
new Where(columnName, operator, value) . |
static Where |
where(String columnName,
Operator operator,
Boolean value)
Factory method equivalent to
new Where(columnName, operator, value) . |
static Where |
where(String columnName,
Operator operator,
Instant value)
Factory method equivalent to
new Where(columnName, operator, value) . |
static Where |
where(String columnName,
Operator operator,
Long value)
Factory method equivalent to
new Where(columnName, operator, value) . |
static Where |
where(String columnName,
Operator operator,
String value)
Factory method equivalent to
new Where(columnName, operator, value) . |
static <T> Where |
where(String columnName,
Operator operator,
T value,
GenericColumn<T> column)
Factory method equivalent to
new Where(columnName, operator, value, column) . |
static Where |
where(Where subWhere)
Factory method equivalent to
new Where(subWhere) . |
public Where()
public Where(Where subWhere)
Where
instance that is grouped,
that is, when the SQL where clause is generated, whatever is
inside the passed where instance will be wrapped inside
parentheses.subWhere
- The predicates to be wrappedpublic Where(String columnName, Operator operator, Boolean value)
Where
object
containing one predicate.columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where(String columnName, Operator operator, Long value)
Where
object
containing one predicate.columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where(String columnName, Operator operator, String value)
Where
object
containing one predicate.columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where(String columnName, Operator operator, BigDecimal value)
Where
object
containing one predicate.columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where(String columnName, Operator operator, Instant value)
Where
object
containing one predicate.columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where(String columnName, Operator operator, T value, GenericColumn<T> column)
Where
object
containing one predicate.T
- The type supported by the columncolumnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstcolumn
- The descriptor of the column typepublic static Where where()
new Where()
.
This will create an empty clause that will match anything.public static Where where(Where subWhere)
new Where(subWhere)
.subWhere
- an existing predicate that will be grouped parenthetically
within the new objectpublic static Where where(String columnName, Operator operator, Boolean value)
new Where(columnName, operator, value)
.
Creates a new Where
object containing one predicate.columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic static Where where(String columnName, Operator operator, Long value)
new Where(columnName, operator, value)
.
Creates a new Where
object containing one predicate.columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic static Where where(String columnName, Operator operator, String value)
new Where(columnName, operator, value)
.
Creates a new Where
object containing one predicate.columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic static Where where(String columnName, Operator operator, BigDecimal value)
new Where(columnName, operator, value)
.
Creates a new Where
object containing one predicate.columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic static Where where(String columnName, Operator operator, Instant value)
new Where(columnName, operator, value)
.
Creates a new Where
object containing one predicate.columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic static <T> Where where(String columnName, Operator operator, T value, GenericColumn<T> column)
new Where(columnName, operator, value, column)
.
Creates a new Where
object containing one predicate.T
- The type supported by the columncolumnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstcolumn
- The descriptor of the column typepublic static Where isNull(String columnName)
columnName
- The column to test for a null value.public static Where isNotNull(String columnName)
columnName
- The column to test for a not null value.public static Where inLong(String columnName, List<Long> elements)
IN
clause applying to the specified column and
including the passed list of numbers.columnName
- The column name the IN
clause applies toelements
- The numbers that should be matchedpublic static Where inString(String columnName, List<String> elements)
IN
clause applying to the specified column and
including the passed list of strings.columnName
- The column name the IN
clause applies toelements
- The strings that should be matchedpublic static Where inBigDecimal(String columnName, List<BigDecimal> elements)
IN
clause applying to the specified column and
including the passed list of numbers.columnName
- The column name the IN
clause applies toelements
- The numbers that should be matchedpublic static Where inInstant(String columnName, List<Instant> elements)
IN
clause applying to the specified column and
including the passed list of dates.columnName
- The column name the IN
clause applies toelements
- The dates that should be matchedpublic static <T> Where inColumn(String columnName, GenericColumn<T> column, List<T> elements)
IN
clause applying to the specified column and
including the passed list of elements.T
- The type of elementcolumnName
- The column name the IN
clause applies tocolumn
- A column supporting the T
typeelements
- The elements that should be matchedpublic static Where notInLong(String columnName, List<Long> elements)
NOT IN
clause applying to the specified column and
excluding the passed list of numbers.columnName
- The column name the NOT IN
clause applies toelements
- The numbers that should be excludedpublic static Where notInString(String columnName, List<String> elements)
NOT IN
clause applying to the specified column and
excluding the passed list of strings.columnName
- The column name the NOT IN
clause applies toelements
- The strings that should be excludedpublic static Where notInBigDecimal(String columnName, List<BigDecimal> elements)
NOT IN
clause applying to the specified column and
excluding the passed list of numbers.columnName
- The column name the NOT IN
clause applies toelements
- The numbers that should be excludedpublic static Where notInInstant(String columnName, List<Instant> elements)
NOT IN
clause applying to the specified column and
excluding the passed list of dates.columnName
- The column name the NOT IN
clause applies toelements
- The dates that should be excludedpublic static <T> Where notInColumn(String columnName, GenericColumn<T> column, List<T> elements)
NOT IN
clause applying to the specified column and
excluding the passed list of elements.T
- The type of elementcolumnName
- The column name the NOT IN
clause applies tocolumn
- A column supporting the T
typeelements
- The elements that should be excludedpublic Where and(Where subWhere)
subWhere
- the new predicate to addpublic Where and(String columnName, Operator operator, Long value)
columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where and(String columnName, Operator operator, BigDecimal value)
columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where and(String columnName, Operator operator, String value)
columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where and(String columnName, Operator operator, Instant value)
columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where and(String columnName, Operator operator, Boolean value)
columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic <T> Where and(String columnName, Operator operator, T value, GenericColumn<T> column)
T
- The type supported by the columncolumnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstcolumn
- The descriptor of this column typepublic Where or(Where subWhere)
subWhere
- the new predicate to addpublic Where or(String columnName, Operator operator, Long value)
columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where or(String columnName, Operator operator, BigDecimal value)
columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where or(String columnName, Operator operator, String value)
columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where or(String columnName, Operator operator, Boolean value)
columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic Where or(String columnName, Operator operator, Instant value)
columnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstpublic <T> Where or(String columnName, Operator operator, T value, GenericColumn<T> column)
T
- The type supported by the columncolumnName
- The column name the predicate applies tooperator
- The operation used to evaluate the predicatevalue
- The value to compare the column values againstcolumn
- The descriptor of this column typepublic String render()
render
in interface StatementPopulator
public String renderNoPrefix()
public void populate(PreparedStatement preparedStatement) throws SQLException
populate
in interface StatementPopulator
SQLException
Copyright © 2019. All rights reserved.