1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.search;
16  
17  import com.liferay.portal.kernel.util.StringBundler;
18  
19  import java.io.Serializable;
20  
21  /**
22   * <a href="Sort.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Bruno Farache
25   */
26  public class Sort implements Serializable {
27  
28      public static final int AUTO_TYPE = 2;
29  
30      public static final int CUSTOM_TYPE = 9;
31  
32      public static final int DOC_TYPE = 1;
33  
34      public static final int DOUBLE_TYPE = 7;
35  
36      public static final int FLOAT_TYPE = 5;
37  
38      public static final int INT_TYPE = 4;
39  
40      public static final int LONG_TYPE = 6;
41  
42      public static final int SCORE_TYPE = 0;
43  
44      public static final int STRING_TYPE = 3;
45  
46      public Sort() {
47      }
48  
49      public Sort(String fieldName, boolean reverse) {
50          this(fieldName, AUTO_TYPE, reverse);
51      }
52  
53      public Sort(String fieldName, int type, boolean reverse) {
54          _fieldName = fieldName;
55          _type = type;
56          _reverse = reverse;
57      }
58  
59      public String getFieldName() {
60          return _fieldName;
61      }
62  
63      public int getType() {
64          return _type;
65      }
66  
67      public boolean isReverse() {
68          return _reverse;
69      }
70  
71      public void setFieldName(String fieldName) {
72          _fieldName = fieldName;
73      }
74  
75      public void setReverse(boolean reverse) {
76          _reverse = reverse;
77      }
78  
79      public void setType(int type) {
80          _type = type;
81      }
82  
83      public String toString() {
84          StringBundler sb = new StringBundler(7);
85  
86          sb.append("{fieldName=");
87          sb.append(_fieldName);
88          sb.append(", type=");
89          sb.append(_type);
90          sb.append(", reverse=");
91          sb.append(_reverse);
92          sb.append("}");
93  
94          return sb.toString();
95      }
96  
97      private String _fieldName;
98      private boolean _reverse;
99      private int _type;
100 
101 }