SortCriteria Class
DEPRECATED
- public class SortCriteria
extends Object
implements Cloneable
, Comparable
, Serializable
A class which handles the sortBy part of a Search.
This object represents a single sort criteria, which is a property name
and an ascending/descending flag. The class provides a utility method to
parse a sortBy string into an array of SortCriteria.
This supports standard SQL-style sort by clauses of the form:
<propname>[ASC|DESC], ...
where ASC|DESC is optional, defaulting to ASC; also, if propname contains a
".", it assumed to be <properyset>.<propname>. Additionally,
if the property name contains non-identifier characters
(e.g. whitespace, double quotes, dashes, etc.), you can use the
toProperty('propname')
or
toProperty('propertyset', 'propname')
construct.
Examples of valid sortBy clauses:
- size
- mimeType, size DESC
- toProperty('Preferred Color') DESC, creationDate, author, modifiedDate
-
Hierarchy
-
Object
SortCriteria
-
All Implemented Interfaces
-
Cloneable
, Comparable
, Serializable
isAscending
public boolean isAscending
- The ascending or descending order.
propertyName
public String
propertyName
- The property name to sort on.
propertySet
public String
propertySet
- The property set name.
SortCriteria
public SortCriteria(String
propertyName,
boolean isAscending)
- Constructor.
SortCriteria
public SortCriteria(String
propertySet,
String
propertyName,
boolean isAscending)
- Constructor.
SortCriteria
public SortCriteria(String
propertyName)
- Constructor.
clone() Method
public Object
clone()
Clone this object.
-
Overrides
-
Object.clone()
compareTo(Object) Method
public int compareTo(Object
obj)
Compare this object to another object.
equals(Object) Method
public boolean equals(Object
o)
Determine if this object is equal to another object.
-
Overrides
-
Object.equals(Object)
getSortCriteria(String) Method
public static SortCriteria
[] getSortCriteria(String
sortBy)
throws IllegalArgumentException
Parse the given sort string and return an array of SortCriteria.
Parameters
-
sortBy
- the sort string (e.g. "identifier ASC, creationDate
DESC").
Returns
- the array of SortCriteria.
Exceptions
-
IllegalArgumentException
- thrown on an invalid sortBy string.
hashCode() Method
public int hashCode()
Override the hashCode because we overrid equals().
-
Overrides
-
Object.hashCode()
toString() Method
public String
toString()
Convert to a string.
-
Overrides
-
Object.toString()