SortCriteria Class

DEPRECATED

com.bea.p13n.content.expression
SortCriteria Class

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:


Hierarchy
Object
  SortCriteria
All Implemented Interfaces

Cloneable, Comparable, Serializable

Field Summary

public boolean
isAscending
The ascending or descending order.
public String
propertyName
The property name to sort on.
public String
propertySet
The property set name.
 

Constructor Summary

SortCriteria(String propertyName, boolean isAscending)

Constructor.
SortCriteria(String propertySet, String propertyName, boolean isAscending)

Constructor.
SortCriteria(String propertyName)

Constructor.
 

Method Summary

public Object
clone()
Clone this object.
public int
compareTo(Object obj)
Compare this object to another object.
public boolean
equals(Object o)
Determine if this object is equal to another object.
public static SortCriteria[]
getSortCriteria(String sortBy)
Parse the given sort string and return an array of SortCriteria.
public int
hashCode()
Override the hashCode because we overrid equals().
public String
toString()
Convert to a string.
 
Methods from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
   
Methods from interface java.lang.Comparable
compareTo
 

Field Detail

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.

 

Constructor Detail

SortCriteria

public SortCriteria(String propertyName, 
                    boolean isAscending)
Constructor.

SortCriteria

public SortCriteria(String propertySet, 
                    String propertyName, 
                    boolean isAscending)
Constructor.

SortCriteria

public SortCriteria(String propertyName)
Constructor.
 

Method Detail

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()