public class Criterion extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static String |
AND
Constant for the operator " AND ".
|
static String |
OR
Constant for the operator " OR ".
|
Constructor and Description |
---|
Criterion(Criterion toCopy)
Creates a shallow copy of the given Criterion.
|
Criterion(Object lValue,
Object rValue)
Create a new instance without verbatim sql, using equals as
comparison operator.
|
Criterion(Object lValue,
Object rValue,
SqlEnum comparison)
Create a new instance without verbatim sql.
|
Criterion(Object lValue,
Object rValue,
SqlEnum comparison,
String sql,
Object[] preparedStatementReplacements)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
Criterion |
and(Criterion criterion)
Replaces this criterion's condition with
(this criterion's condition AND criterion).
|
void |
appendTo(StringBuilder sb)
Appends a debug String representation of the Criterion
onto the String builder.
|
boolean |
equals(Object obj) |
SqlEnum |
getComparison()
Get the comparison.
|
String |
getConjunction()
Returns the conjunction for the parts of this criterion
|
Object |
getLValue()
Get the left hand side value of the comparison.
|
List<Criterion> |
getParts()
Returns the parts of which this criterion consists.
|
Object[] |
getPreparedStatementReplacements()
Returns the prepared statement replacements for a verbatim sql condition.
|
Object |
getRValue()
Get the right hand side value of the comparison.
|
String |
getSql()
Returns the verbatim sql for this condition.
|
int |
hashCode() |
boolean |
isComposite()
Returns whether this criterion is a composite criterion.
|
boolean |
isIgnoreCase()
Is ignore case on or off?
|
boolean |
isVerbatimSqlCondition()
Returns whether this Criterion represents a verbatim sql condition.
|
Criterion |
or(Criterion criterion)
Replaces this criterion's condition with
(this criterion's condition OR criterion).
|
Criterion |
setIgnoreCase(boolean b)
Sets ignore case.
|
void |
setLValue(Object lValue)
Set the left hand side value of the comparison.
|
void |
setRValue(Object rValue)
Set the right hand side value of the comparison.
|
String |
toString()
Build a string representation of the Criterion for debug purposes.
|
public static final String AND
public static final String OR
public Criterion(Object lValue, Object rValue, SqlEnum comparison, String sql, Object[] preparedStatementReplacements)
lValue
- the left hand side value of the comparison.
If this value should be a value from the database,
the object must implement the
org.apache.torque.Column
interface.rValue
- the right hand side value of the comparison.
If this value should be a value from the database,
the object must implement the
org.apache.torque.Column
interface.comparison
- The comparison operator. Either this parameter or
sql must be not null.sql
- a verbatim sql condition. Either this parameter or
comparison must be not null.preparedStatementReplacements
- Values for the placeholders
in the verbatim sql condition.NullPointerException
- if column is null.public Criterion(Object lValue, Object rValue)
lValue
- the left hand side value of the comparison, not null.
If this value should be a value from the database,
the object must implement the
org.apache.torque.Column
interface.rValue
- the right hand side value of the comparison.
If this value should be a value from the database,
the object must implement the
org.apache.torque.Column
interface.public Criterion(Object lValue, Object rValue, SqlEnum comparison)
lValue
- the left hand side value of the comparison, not null.
If this value should be a value from the database,
the object must implement the
org.apache.torque.Column
interface.rValue
- the right hand side value of the comparison.
If this value should be a value from the database,
the object must implement the
org.apache.torque.Column
interface.comparison
- The comparison operator, not null.public Criterion(Criterion toCopy)
toCopy
- the Criterion to copy from, not null.public Object getLValue()
org.apache.torque.Column
interface.public void setLValue(Object lValue)
lValue
- the left hand side value of the comparison.
If this value is a value computed by the database,
the object must implement the
org.apache.torque.Column
interface.public SqlEnum getComparison()
public Object getRValue()
org.apache.torque.Column
interface.public void setRValue(Object rValue)
rValue
- the right hand side value of the comparison.
If this value is a value computed by the database,
the object must implement the
org.apache.torque.Column
interface.public String getSql()
public Object[] getPreparedStatementReplacements()
public boolean isVerbatimSqlCondition()
public Criterion setIgnoreCase(boolean b)
b
- True if case should be ignored.public boolean isIgnoreCase()
public List<Criterion> getParts()
public String getConjunction()
public boolean isComposite()
public Criterion and(Criterion criterion)
criterion
- the criterion to and with this criterion,
not null.public Criterion or(Criterion criterion)
criterion
- the criterion to and with this criterion,
not null.public void appendTo(StringBuilder sb)
sb
- the string representationpublic String toString()
Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.