KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > databinding > datagrid > api > sort > Sort


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.databinding.datagrid.api.sort;
19
20 /**
21  * <p>
22  * The Sort class is a JavaBean that abstractly represents the data needed to calculate a sort
23  * on some data set. A sort consists of some {@link String} expression and a {@link SortDirection}.
24  * The mechanism for performing the sort is not provided here.
25  * </p>
26  * <p>
27  * A Sort object can be used by some sorting infrastructure to either parameterise a SQL or XQuery
28  * query or to simply sort in-memory Java objects. For example, when converting a Sort into
29  * a SQL fragment, a Sort with sortExpression "foo" and sortDirection {@link SortDirection#DESCENDING} could
30  * be converted into:
31  * <pre>
32  * ORDER BY FOO DESC
33  * </pre>
34  * </p>
35 */

36 public class Sort
37     implements java.io.Serializable JavaDoc {
38
39     private String JavaDoc _sortExpression;
40     private SortDirection _sortDirection;
41
42     /**
43      * Empty constructor.
44      */

45     public Sort() {
46     }
47
48     /**
49      * Constructs a Sort with the given <code>sortExpression</code> and <code>sortDirection</code>.
50      *
51      * @param sortExpression the Sort's sort expression
52      * @param sortDirection the Sort's sort direction
53      */

54     public Sort(String JavaDoc sortExpression, SortDirection sortDirection) {
55         this();
56         _sortExpression = sortExpression;
57         _sortDirection = sortDirection;
58     }
59
60     /**
61      * Get the sort expression
62      * @return the sort expression
63      */

64     public String JavaDoc getSortExpression() {
65         return _sortExpression;
66     }
67
68     /**
69      * Set the sort expression
70      * @param expression the sort expression
71      */

72     public void setSortExpression(String JavaDoc expression) {
73         _sortExpression = expression;
74     }
75
76     /**
77      * Get the {@link SortDirection}
78      * @return the sort direction
79      */

80     public SortDirection getDirection() {
81         return _sortDirection;
82     }
83
84     /**
85      * Set the {@link SortDirection}
86      * @param sortDirection the sort direction
87      */

88     public void setDirection(SortDirection sortDirection) {
89         _sortDirection = sortDirection;
90     }
91 }
92
Popular Tags