View Javadoc
1   /*
2    * Copyright 2018-2022 Medical Information Systems Research Group (https://medical.zcu.cz),
3    * Department of Computer Science and Engineering, University of West Bohemia.
4    * Address: Univerzitni 8, 306 14 Plzen, Czech Republic.
5    *
6    * Author Petr Vcelak (vcelak@kiv.zcu.cz).
7    *
8    * This file is part of MRECore project.
9    *
10   * MRECore is free software: you can redistribute it and/or modify
11   * it under the terms of the GNU General Public License as published by
12   * the Free Software Foundation, either version 3 of the License.
13   *
14   * MRECore is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   * GNU General Public License for more details.
18   *
19   * You should have received a copy of the GNU General Public License
20   * along with MRECore. If not, see <http://www.gnu.org/licenses/>.
21   */
22  package cz.zcu.mre.data.datatable;
23  
24  /**
25   * The Enum DataTableQuerySortOrder.
26   * 
27   * @author Petr Vcelak (vcelak@kiv.zcu.cz)
28   */
29  public enum DataTableQuerySortOrder {
30  
31      /**
32       * The asc.
33       */
34      ASC("ASC"),
35      /**
36       * The desc.
37       */
38      DESC("DESC");
39  
40      /**
41       * The value.
42       */
43      private final String value;
44  
45      /**
46       * Instantiates a new sort order.
47       *
48       * @param v the v
49       */
50      DataTableQuerySortOrder(String v) {
51          value = v;
52      }
53  
54      /**
55       * From value.
56       *
57       * @param v the v
58       * @return the sort order
59       */
60      public static DataTableQuerySortOrder fromValue(String v) {
61  
62          for (DataTableQuerySortOrder c : DataTableQuerySortOrder.values()) {
63              if (c.name().equals(v.toUpperCase())) {
64                  return c;
65              }
66          }
67          throw new IllegalArgumentException(v);
68      }
69  
70      /**
71       * Value.
72       *
73       * @return the string
74       */
75      public String value() {
76          return value;
77      }
78  
79      @Override
80      public String toString() {
81          return "SortOrder{" + "value=" + value + '}';
82      }
83  
84  }