KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > storage > search > SortOrder


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.storage.search;
11
12 /**
13  * A sortorder specifies sorting of a single field.
14  * <p>
15  * This corresponds to use of ORDER BY in SQL SELECT-syntax.
16  *
17  * @author Rob van Maris
18  * @version $Id: SortOrder.java,v 1.4 2005/05/26 07:50:47 michiel Exp $
19  * @since MMBase-1.7
20  */

21 public interface SortOrder {
22
23     /** Order for <em>ascending</em> sort order. */
24     int ORDER_ASCENDING = 1;
25
26     /** Order for <em>descending</em> sort order. */
27     int ORDER_DESCENDING = 2;
28
29     /**
30      * Order descriptions corresponding to the order values:
31      * {@link #ORDER_ASCENDING}, and {@link #ORDER_DESCENDING}
32      */

33     public final static String JavaDoc[] ORDER_DESCRIPTIONS = new String JavaDoc[] {
34          null, // not specified
35
"ascending",
36          "descending"
37     };
38
39     /**
40      * Gets the associated field.
41      * <p>
42      * This corresponds to a fieldname in a "ORDER BY" clause in SQL SELECT-syntax.
43      */

44     StepField getField();
45
46     /**
47      * Gets the sort direction. This is be either ORDER_ASCENDING or ORDER_DESCENDING.
48      * <p>
49      * This corresponds to the use of ASC and DESC in SQL SELECT-syntax.
50      */

51     int getDirection();
52
53     /**
54      * Whether sorting must happen case sensitivily. If not, normally something like ordering on the
55      * uppercased field will happen.
56      * @since MMBase-1.8
57      */

58     boolean isCaseSensitive();
59
60     /**
61      * Compares this sortorder to the specified object. The result is
62      * <code>true</code> if and only if the argument is a non-null
63      * SortOrder object associated with the same field, using the same
64      * sort direction.
65      *
66      * @param obj The object to compare with.
67      * @return <code>true</code> if the objects are equal,
68      * <code>false</code> otherwise.
69      */

70     public boolean equals(Object JavaDoc obj);
71
72     // javadoc is inherited
73
public int hashCode();
74
75     /**
76      * Returns a string representation of this SortOrder.
77      * The string representation has the form
78      * "SortOrder(field:&lt;field&gt;, dir:&lt;dir&gt;)"
79      * where
80      * <ul>
81      * <li><em>&lt;field&gt;</em> is the field alias returned by
82      * <code>getField().getAlias()</code>
83      * <li><em>&lt;dir&gt;</em> is the direction returned by
84      * {@link #getDirection getDirection()}
85      * </ul>
86      *
87      * @return A string representation of this SortOrder.
88      */

89     public String JavaDoc toString();
90
91     /** @link dependency
92      * @clientRole 0-1*/

93     /*#StepField lnkStepField;*/
94
95     /** @link dependency
96      * @clientRole **/

97     /*#SearchQuery lnkSearchQuery;*/
98 }
99
Popular Tags