KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > vlib > ejb > SortOrdering


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

15 package org.apache.tapestry.vlib.ejb;
16
17 import java.io.Serializable JavaDoc;
18
19 import org.apache.commons.lang.builder.ToStringBuilder;
20
21 /**
22  * Used with {@link org.apache.tapestry.vlib.ejb.IBookQuery} to represent
23  * the order in which columns are sorted in the result set. SortOrdering
24  * is immutable.
25  *
26  * @author Howard Lewis Ship
27  * @version $Id: SortOrdering.java,v 1.5 2004/02/19 17:37:39 hlship Exp $
28  * @since 3.0
29  *
30  **/

31
32 public class SortOrdering implements Serializable JavaDoc
33 {
34     private static final long serialVersionUID = -1621923918904975133L;
35     
36     private SortColumn _column;
37     private boolean _descending;
38
39     public SortOrdering(SortColumn column)
40     {
41         this(column, false);
42     }
43
44     public SortOrdering(SortColumn column, boolean descending)
45     {
46         _column = column;
47         _descending = descending;
48     }
49
50     public boolean isDescending()
51     {
52         return _descending;
53     }
54
55     public SortColumn getColumn()
56     {
57         return _column;
58     }
59
60     public String JavaDoc toString()
61     {
62         ToStringBuilder builder = new ToStringBuilder(this);
63         builder.append("column", _column);
64         builder.append("descending", _descending);
65
66         return builder.toString();
67     }
68
69 }
70
Popular Tags