Package org.synchronoss.cpo.core
Interface CpoWhere
- All Known Implementing Classes:
BindableCpoWhere,JdbcCpoWhere
public interface CpoWhere
`CpoWhere` is an interface for specifying the where clause to filter objects that are returned
from the Datasource.
A `CpoWhere` node is either a *leaf*, comparing an attribute to a value or another attribute,
or a *branch*, formed by chaining leaves/branches together with addWhere(CpoWhere) and a
Logical operator. Use isLeaf() to tell which kind a given instance is.
- Author:
- david berry
-
Method Summary
Modifier and TypeMethodDescriptionvoidChains another where clause onto this one, joined by this instance'sLogicaloperator, turning this instance into a branch node.Gets the name of the bean attribute on the left-hand side of the comparison.Gets the native datastore function applied to the left-hand attribute before comparison.Gets theComparisonoperator used to compare the attribute against the value or right-hand attribute.Gets theLogicaloperator used to join this where clause with the next one added viaaddWhere(CpoWhere).getName()Gets a string representing the name of this instance of the CpoOrderBybooleangetNot()Gets whether this where clause's comparison result is negated.Gets the name of the bean attribute to compare against, when comparing two attributes rather than an attribute and a literal value.Gets the native datastore function applied to the right-hand attribute before comparison.Gets the literal, unescaped value used in place of a bound comparison value.getValue()Gets the literal value the attribute is compared against.Gets the native datastore function applied to the comparison value before comparison.booleanisLeaf()Gets whether this instance is a leaf node (a single comparison) rather than a branch node formed byaddWhere(CpoWhere).voidsetAttribute(String attr) Sets the name of the bean attribute on the left-hand side of the comparison.voidSets a native datastore function (e.g.voidsetComparison(Comparison comparison) Sets theComparisonoperator (e.g. equals, greater-than) used to compare the attribute against the value or right-hand attribute.voidsetLogical(Logical logical) Sets theLogicaloperator (e.g.voidSets a string representing the name of this instance of the CpoOrderByvoidsetNot(boolean b) Sets whether this where clause's comparison result should be negated.voidsetRightAttribute(String attr) Sets the name of the bean attribute to compare against, when comparing two attributes rather than an attribute and a literal value.voidSets a native datastore function (e.g.voidsetStaticValue(String staticValue) Sets a literal, unescaped value to use in place of a bound comparison value, inserted directly into the native expression.voidSets the literal value to compare the attribute against.voidSets a native datastore function (e.g.
-
Method Details
-
setComparison
Sets theComparisonoperator (e.g. equals, greater-than) used to compare the attribute against the value or right-hand attribute.- Parameters:
comparison- the comparison operator for this where clause
-
getComparison
Comparison getComparison()Gets theComparisonoperator used to compare the attribute against the value or right-hand attribute.- Returns:
- the comparison operator for this where clause
-
setLogical
Sets theLogicaloperator (e.g. AND, OR) used to join this where clause with the next one added viaaddWhere(CpoWhere).- Parameters:
logical- the logical operator joining this clause to the next
-
getLogical
Logical getLogical()Gets theLogicaloperator used to join this where clause with the next one added viaaddWhere(CpoWhere).- Returns:
- the logical operator joining this clause to the next
-
setAttribute
Sets the name of the bean attribute on the left-hand side of the comparison.- Parameters:
attr- the attribute name
-
getAttribute
String getAttribute()Gets the name of the bean attribute on the left-hand side of the comparison.- Returns:
- the attribute name
-
setRightAttribute
Sets the name of the bean attribute to compare against, when comparing two attributes rather than an attribute and a literal value.- Parameters:
attr- the right-hand attribute name
-
getRightAttribute
String getRightAttribute()Gets the name of the bean attribute to compare against, when comparing two attributes rather than an attribute and a literal value.- Returns:
- the right-hand attribute name
-
setValue
Sets the literal value to compare the attribute against.- Parameters:
val- the comparison value
-
getValue
Object getValue()Gets the literal value the attribute is compared against.- Returns:
- the comparison value
-
getNot
boolean getNot()Gets whether this where clause's comparison result is negated.- Returns:
- `true` if the comparison is negated (NOT), `false` otherwise
-
setNot
void setNot(boolean b) Sets whether this where clause's comparison result should be negated.- Parameters:
b- `true` to negate the comparison (NOT), `false` otherwise
-
addWhere
Chains another where clause onto this one, joined by this instance'sLogicaloperator, turning this instance into a branch node.- Parameters:
cw- the where clause to add- Throws:
CpoException- if the where clause cannot be added
-
setAttributeFunction
Sets a native datastore function (e.g. `UPPER`) to apply to the left-hand attribute before comparison.- Parameters:
s- the function expression to apply to the attribute
-
getAttributeFunction
String getAttributeFunction()Gets the native datastore function applied to the left-hand attribute before comparison.- Returns:
- the function expression applied to the attribute
-
setValueFunction
Sets a native datastore function (e.g. `UPPER`) to apply to the comparison value before comparison.- Parameters:
s- the function expression to apply to the value
-
getValueFunction
String getValueFunction()Gets the native datastore function applied to the comparison value before comparison.- Returns:
- the function expression applied to the value
-
setRightAttributeFunction
Sets a native datastore function (e.g. `UPPER`) to apply to the right-hand attribute before comparison.- Parameters:
s- the function expression to apply to the right-hand attribute
-
getRightAttributeFunction
String getRightAttributeFunction()Gets the native datastore function applied to the right-hand attribute before comparison.- Returns:
- the function expression applied to the right-hand attribute
-
setStaticValue
Sets a literal, unescaped value to use in place of a bound comparison value, inserted directly into the native expression.- Parameters:
staticValue- the static (literal) value text
-
getStaticValue
String getStaticValue()Gets the literal, unescaped value used in place of a bound comparison value.- Returns:
- the static (literal) value text
-
isLeaf
boolean isLeaf()Gets whether this instance is a leaf node (a single comparison) rather than a branch node formed byaddWhere(CpoWhere).- Returns:
- `true` if this is a leaf comparison node, `false` if it is a branch
-
getName
String getName()Gets a string representing the name of this instance of the CpoOrderBy- Returns:
- String The name of the CpoOrderBy
-
setName
Sets a string representing the name of this instance of the CpoOrderBy- Parameters:
s- The name of the CpoOrderBy
-