Package org.apache.torque.sql
Class WhereClauseExpression
- java.lang.Object
-
- org.apache.torque.sql.WhereClauseExpression
-
public class WhereClauseExpression extends Object
The raw values for a part of the where clause of a SQL statement, either of the form lValue operator rValue, e.g. author.author_id = 1, or in form of a custom sql query with sql and replacement values.- Version:
- $Id: WhereClauseExpression.java 1867515 2019-09-25 15:02:03Z gk $
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Object
getLValue()
Returns the value on the left hand side of the operator of the expression.SqlEnum
getOperator()
Returns the value on the operator of the expression.Object[]
getPreparedStatementReplacements()
Returns the values for the placeholders in the verbatim sql condition.Object
getRValue()
Returns the value on the right hand side of the operator of the expression.String
getSql()
Returns the verbatim sql for this expression, if any.int
hashCode()
boolean
isVerbatimSqlCondition()
Returns whether this expression represents a verbatim sql condition.void
setLValue(Object lValue)
Sets the value on the left hand side of the operator of the expression.void
setOperator(SqlEnum operator)
Sets the value on the operator of the expression.void
setRValue(Object rValue)
Sets the value on the right hand side of the operator of the expression.String
toString()
-
-
-
Constructor Detail
-
WhereClauseExpression
public WhereClauseExpression(Object lValue, SqlEnum operator, Object rValue, String sql, Object[] preparedStatementReplacements)
Constructor.- Parameters:
lValue
- The value on the left hand side of the operator of the expression. The value represents the name of a database column.operator
- the operator. Either this parameter or sql must be not null.rValue
- The value on the right hand side of the operator of the expression. The value represents the name of a database column.sql
- a verbatim sql condition. Either this parameter or operator must be not null.preparedStatementReplacements
- Values for the placeholders in the verbatim sql condition.
-
-
Method Detail
-
getLValue
public Object getLValue()
Returns the value on the left hand side of the operator of the expression.- Returns:
- the lValue.
-
setLValue
public void setLValue(Object lValue)
Sets the value on the left hand side of the operator of the expression. The value represents the name of a database column.- Parameters:
lValue
- the value to set, not null or empty.- Throws:
IllegalArgumentException
- if lValue is null or empty.
-
getOperator
public SqlEnum getOperator()
Returns the value on the operator of the expression.- Returns:
- the operator, or null if this Expression represents a verbatim sql expression.
-
setOperator
public void setOperator(SqlEnum operator)
Sets the value on the operator of the expression.- Parameters:
operator
- the value to set, or null fo no operator.
-
getRValue
public Object getRValue()
Returns the value on the right hand side of the operator of the expression.- Returns:
- the rValue, or null.
-
setRValue
public void setRValue(Object rValue)
Sets the value on the right hand side of the operator of the expression.- Parameters:
rValue
- the value to set, or null for the empty String.
-
getSql
public String getSql()
Returns the verbatim sql for this expression, if any.- Returns:
- the verbatim sql for this expression, or null if not given.
-
getPreparedStatementReplacements
public Object[] getPreparedStatementReplacements()
Returns the values for the placeholders in the verbatim sql condition.- Returns:
- the placeholder values, or null.
-
isVerbatimSqlCondition
public boolean isVerbatimSqlCondition()
Returns whether this expression represents a verbatim sql condition.- Returns:
- true if this Criterion represents a verbatim sql condition, false if the sql is computed from lValue, comparison and rValue.
-
-