R
- row classpublic abstract class AbstractWhereTranslator<R> extends ColumnsTranslator<R>
Constructor and Description |
---|
AbstractWhereTranslator(RowTranslator<R> rowTranslator)
Constructs for row translator.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumnTranslator(ColumnTranslator<R> c)
Adds translator with equal as operator and "AND" as boolean operator.
|
void |
addColumnTranslator(ColumnTranslator<R> c,
java.lang.String booleanOperator,
java.lang.String comparisonOperator,
java.lang.String operand)
Adds translator with a specific sql comparison operator and boolean operator.
|
java.lang.String |
createColumnParameterPhrase()
Creates column phrase with parameter placeholders and comparison operators like:
"c1 cop1 a1 bo2 c2 cop2 a2 bo3 c3 cop3 a3..." where cN is column name, copN is WhereField.comparisonOperator() , aN is operand (typically "?"), and
boN is WhereField.booleanOperator() |
java.lang.String |
createSql()
Creates SQL for where phrase.
|
java.lang.Object[] |
getParameters() |
RowTranslator<R> |
getRowTranslator()
Gets row translator that was supplied in constructor.
|
protected void |
initColumnTranslatorList(int columns)
Initializes objects to hold all column information.
|
boolean |
isCollectionOperand()
Tests if where condition contains at least one column with an operand that use
a collection as a parameter.
|
void |
setParameters(java.lang.Object[] parameters)
Sets parameters that are used in where phrase.
|
createColumnPhrase, createParameterPhrase, getColumnTranslator, getColumnTranslatorList, getRowClass, isIncluded, isIncludeIdentityColumns, isIncludeReadOnlyColumns, read, setIncludeIdentityColumns, setIncludeReadOnlyColumns, write
public AbstractWhereTranslator(RowTranslator<R> rowTranslator) throws TranslatorException
rowTranslator
- row translator associated with where conditionTranslatorException
- if errorprotected void initColumnTranslatorList(int columns)
initColumnTranslatorList
in class ColumnsTranslator<R>
columns
- approximate number of columns that will be in translator (used as initial capacity)public java.lang.Object[] getParameters()
setParameters(Object[])
public void setParameters(java.lang.Object[] parameters)
SqlOperation.getParameters()
.parameters
- parameters for where phrase; null if nonepublic java.lang.String createSql()
public RowTranslator<R> getRowTranslator()
public void addColumnTranslator(ColumnTranslator<R> c)
addColumnTranslator
in class ColumnsTranslator<R>
c
- column translator to addpublic void addColumnTranslator(ColumnTranslator<R> c, java.lang.String booleanOperator, java.lang.String comparisonOperator, java.lang.String operand)
c
- column translator to addbooleanOperator
- logical operator to precede this column (examples: "AND", "OR", "AND NOT", etc.)comparisonOperator
- sql comparison operator to use in where condition (examples: ">", "=<", "<>", etc.)operand
- operand to follow operator; typically "?" indicates operand is SQL parameterpublic boolean isCollectionOperand()
public java.lang.String createColumnParameterPhrase()
WhereField.comparisonOperator()
, aN is operand (typically "?"), and
boN is WhereField.booleanOperator()
createColumnParameterPhrase
in class ColumnsTranslator<R>