Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.content.expression
Class SortCriteria

    java.lang.Object
      |
      +--com.bea.p13n.content.expression.SortCriteria

public class SortCriteria
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable, java.io.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

See Also:
  Serialized Form

Field Summary
`boolean` | `isAscending` The ascending or descending order.
`java.lang.String` | `propertyName` The property name to sort on.
`java.lang.String` | `propertySet` The property set name.

Constructor Summary
`SortCriteria(java.lang.String propertyName)` Constructor.
`SortCriteria(java.lang.String propertyName, boolean isAscending)` Constructor.
`SortCriteria(java.lang.String propertySet, java.lang.String propertyName, boolean isAscending)` Constructor.

Method Summary
`java.lang.Object` | `clone()` Clone this object.
`int` | `compareTo(java.lang.Object obj)` Compare this object to another object.
`boolean` | `equals(java.lang.Object o)` Determine if this object is equal to another object.
`static SortCriteria[]` | `getSortCriteria(java.lang.String sortBy)` Parse the given sort string and return an array of SortCriteria.
`int` | `hashCode()` Override the hashCode because we overrid equals().
`java.lang.String` | `toString()` Convert to a string.

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### propertySet

    public java.lang.String propertySet

  The property set name.

### propertyName

    public java.lang.String propertyName

  The property name to sort on.

### isAscending

    public boolean isAscending

  The ascending or descending order.

Constructor Detail

### SortCriteria

    public SortCriteria(java.lang.String propertySet,
                        java.lang.String propertyName,
                        boolean isAscending)

  Constructor.

### SortCriteria

    public SortCriteria(java.lang.String propertyName,
                        boolean isAscending)

  Constructor.

### SortCriteria

    public SortCriteria(java.lang.String propertyName)

  Constructor.

Method Detail

### clone

    public java.lang.Object clone()

  Clone this object.

  Overrides:
    clone in class java.lang.Object

### compareTo

    public int compareTo(java.lang.Object obj)

  Compare this object to another object.
  Specified by:
    compareTo in interface java.lang.Comparable

### equals

    public boolean equals(java.lang.Object o)

  Determine if this object is equal to another object.

  Overrides:
    equals in class java.lang.Object

### hashCode

    public int hashCode()

  Override the hashCode because we overrid equals().

  Overrides:
    hashCode in class java.lang.Object

### getSortCriteria

    public static SortCriteria[] getSortCriteria(java.lang.String sortBy)
                                          throws java.lang.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.
  Throws:
    java.lang.IllegalArgumentException - thrown on an invalid sortBy string.

### toString

    public java.lang.String toString()

  Convert to a string.

  Overrides:
    toString in class java.lang.Object

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 BEA Systems, Inc. All Rights Reserved