Package org.synchronoss.cpo.core
Class BindableCpoOrderBy
java.lang.Object
org.synchronoss.cpo.core.BindableCpoOrderBy
- All Implemented Interfaces:
CpoOrderBy
Default
CpoOrderBy implementation: an immutable, bindable sort clause on a single
attribute, optionally wrapped in a native datastore function and associated with a custom marker
for multi-clause substitution.- Author:
- david berry
-
Field Summary
Fields inherited from interface org.synchronoss.cpo.core.CpoOrderBy
DEFAULT_MARKER -
Constructor Summary
ConstructorsConstructorDescriptionBindableCpoOrderBy(String attr, boolean asc) Creates an order-by clause on the given attribute using theCpoOrderBy.DEFAULT_MARKER.BindableCpoOrderBy(String attr, boolean asc, String func) Creates an order-by clause on the given attribute, wrapped in a native datastore function, using theCpoOrderBy.DEFAULT_MARKER.BindableCpoOrderBy(String marker, String attr, boolean asc) Creates an order-by clause on the given attribute using a custom marker, for use when more than one order-by expression must be substituted into the same native expression.BindableCpoOrderBy(String marker, String attr, boolean asc, String func) Creates an order-by clause on the given attribute, wrapped in a native datastore function, using a custom marker, for use when more than one order-by expression must be substituted into the same native expression. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the boolean that determines if the objects will be returned from from the CpoAdapter in Ascending order or Descending orderGets the name of the attribute that is to be used to sort the results from the CpoAdapter.Gets a string representing a datasource specific function call that must be applied to the attribute that will be used for sorting.Gets the string marker that this cpoOrderBy will search for in the expression to replaceBuilds the native (SQL/CQL) order-by fragment for this clause against the given class's attribute-to-column mapping.
-
Constructor Details
-
BindableCpoOrderBy
Creates an order-by clause on the given attribute using theCpoOrderBy.DEFAULT_MARKER.- Parameters:
attr- the name of the attribute to sort byasc-trueto sort ascending,falseto sort descending
-
BindableCpoOrderBy
Creates an order-by clause on the given attribute using a custom marker, for use when more than one order-by expression must be substituted into the same native expression.- Parameters:
marker- the marker string this clause replaces in the expressionattr- the name of the attribute to sort byasc-trueto sort ascending,falseto sort descending
-
BindableCpoOrderBy
Creates an order-by clause on the given attribute, wrapped in a native datastore function, using theCpoOrderBy.DEFAULT_MARKER.- Parameters:
attr- the name of the attribute to sort byasc-trueto sort ascending,falseto sort descendingfunc- the native function expression to apply to the attribute (e.g."upper(attribute_name)")
-
BindableCpoOrderBy
Creates an order-by clause on the given attribute, wrapped in a native datastore function, using a custom marker, for use when more than one order-by expression must be substituted into the same native expression.- Parameters:
marker- the marker string this clause replaces in the expressionattr- the name of the attribute to sort byasc-trueto sort ascending,falseto sort descendingfunc- the native function expression to apply to the attribute (e.g."upper(attribute_name)")
-
-
Method Details
-
getAscending
public boolean getAscending()Gets the boolean that determines if the objects will be returned from from the CpoAdapter in Ascending order or Descending order- Specified by:
getAscendingin interfaceCpoOrderBy- Returns:
- boolean true if it is to sort in Ascensing Order false if it is to be sorted in Descending Order
-
getAttribute
Gets the name of the attribute that is to be used to sort the results from the CpoAdapter.- Specified by:
getAttributein interfaceCpoOrderBy- Returns:
- String The name of the attribute
-
getFunction
Gets a string representing a datasource specific function call that must be applied to the attribute that will be used for sorting.i.e. - "upper(attribute_name)"
- Specified by:
getFunctionin interfaceCpoOrderBy- Returns:
- String The name of the function
-
toString
Builds the native (SQL/CQL) order-by fragment for this clause against the given class's attribute-to-column mapping.- Specified by:
toStringin interfaceCpoOrderBy- Parameters:
cpoClass- the class metadata used to resolve the attribute to a datastore column- Returns:
- the string that will be added into the expression
- Throws:
CpoException- if the attribute cannot be resolved againstcpoClass
-
getMarker
Gets the string marker that this cpoOrderBy will search for in the expression to replace- Specified by:
getMarkerin interfaceCpoOrderBy- Returns:
- String The marker of the CpoOrderBy
-