public class Operator extends Object
Operator
type supports the generation of SQL statements
that specify the various comparisons allows in SQL where clauses.Modifier and Type | Field and Description |
---|---|
static Operator |
EQUALS
An instance that represents the equality ('=') operator.
|
static Operator |
GREATER_THAN
An instance that represents the greater than ('>') operator.
|
static Operator |
GREATER_THAN_OR_EQUALS
An instance that represents the greater than or equals ('>=') operator.
|
static Operator |
LESS_THAN
An instance that represents the less than ('<') operator.
|
static Operator |
LESS_THAN_OR_EQUALS
An instance that represents the less than or equals ('<=') operator.
|
static Operator |
LIKE
An instance that represents the 'LIKE' operator to be used
for string fields.
|
Modifier and Type | Method and Description |
---|---|
static Operator |
closedRangeTo(BigDecimal upperLimit)
To search for items in a range of values, inclusive of the endpoints,
where the field is a decimal type.
|
static Operator |
closedRangeTo(LocalDateTime upperLimit)
To search for items in a range of values, inclusive of the endpoints,
where the field is a date type.
|
static Operator |
closedRangeTo(long upperLimit)
To search for items in a range of values, inclusive of the endpoints,
where the field is an integer type.
|
String |
getSqlString(String columnName)
Returns the text to be inserted in the SQL statement being built.
|
boolean |
hasSecondParameter()
Indication of whether this operator requires two parameters to
be set (it represents a range).
|
static Operator |
openRangeTo(BigDecimal upperLimit)
To search for items in a range of values, not-inclusive of the endpoints,
where the field is a de
cimal type.
|
static Operator |
openRangeTo(LocalDateTime upperLimit)
To search for items in a range of values, not-inclusive of the endpoints,
where the field is a date type.
|
static Operator |
openRangeTo(long upperLimit)
To search for items in a range of values, not-inclusive of the endpoints,
where the field is an integer type.
|
void |
setSecondParameter(int index,
PreparedStatement statement)
Sets the second parameter onto the passed SQL statement.
|
public static final Operator EQUALS
public static final Operator LIKE
public static final Operator LESS_THAN
public static final Operator LESS_THAN_OR_EQUALS
public static final Operator GREATER_THAN
public static final Operator GREATER_THAN_OR_EQUALS
public static Operator openRangeTo(long upperLimit)
Hrorm will search for all records where the field value is greater than the one included in the template object, and less than the upper limit specified here.
upperLimit
- The endpoint of the range to search.public static Operator closedRangeTo(long upperLimit)
Hrorm will search for all records where the field value is greater than or equal to the one included in the template object, and less than or equal to the upper limit specified here.
upperLimit
- The endpoint of the range to search.public static Operator openRangeTo(BigDecimal upperLimit)
Hrorm will search for all records where the field value is greater than the one included in the template object, and less than the upper limit specified here.
upperLimit
- The endpoint of the range to search.public static Operator closedRangeTo(BigDecimal upperLimit)
Hrorm will search for all records where the field value is greater than or equal to the one included in the template object, and less than or equal to the upper limit specified here.
upperLimit
- The endpoint of the range to search.public static Operator openRangeTo(LocalDateTime upperLimit)
Hrorm will search for all records where the field value is greater than the one included in the template object, and less than the upper limit specified here.
upperLimit
- The endpoint of the range to search.public static Operator closedRangeTo(LocalDateTime upperLimit)
Hrorm will search for all records where the field value is greater than or equal to the one included in the template object, and less than or equal to the upper limit specified here.
upperLimit
- The endpoint of the range to search.public String getSqlString(String columnName)
columnName
- The name of the column this operator applies to.public boolean hasSecondParameter()
Used internally by hrorm, and generally of no interest to clients.
public void setSecondParameter(int index, PreparedStatement statement) throws SQLException
Used internally by hrorm, and generally of no interest to clients.
index
- The place in the SQL of the parameter being set.statement
- The SQLSQLException
- on a database errorCopyright © 2019. All rights reserved.