MCPcopy Create free account
hub / github.com/ebean-orm/ebean / OrderBy

Class OrderBy

ebean-api/src/main/java/io/ebean/OrderBy.java:17–502  ·  view source on GitHub ↗

Represents an Order By for a Query. Is an ordered list of OrderBy.Property objects each specifying a property and whether it is ascending or descending order. Typically, you will not construct an OrderBy yourself but use one that exists on the Query object.

Source from the content-addressed store, hash-verified

15 * on the Query object.
16 */
17public class OrderBy<T> implements Serializable {
18
19 private static final long serialVersionUID = 9157089257745730539L;
20
21 private transient Query<T> query;
22
23 private final List<Property> list;
24
25 /**
26 * Create an OrderBy parsing the given order by clause.
27 * <p>
28 * The order by clause follows SQL order by clause with comma's between each
29 * property and optionally "asc" or "desc" to represent ascending or
30 * descending order respectively.
31 */
32 public static <P> OrderBy<P> of(String orderByClause) {
33 return new OrderBy<>(orderByClause);
34 }
35
36 /**
37 * @deprecated This method will be removed from public API.
38 * <p>
39 * Create an empty OrderBy with no associated query.
40 */
41 @Deprecated(forRemoval = true)
42 public OrderBy() {
43 this.list = new ArrayList<>(3);
44 }
45
46 private OrderBy(List<Property> list) {
47 this.list = list;
48 }
49
50 /**
51 * @deprecated migrate to {@link OrderBy#of(String)}.
52 */
53 @Deprecated(forRemoval = true)
54 public OrderBy(String orderByClause) {
55 this(null, orderByClause);
56 }
57
58 /**
59 * @deprecated This method will be removed from public API.
60 */
61 @Deprecated(forRemoval = true)
62 public OrderBy(Query<T> query, String orderByClause) {
63 this.query = query;
64 this.list = new ArrayList<>(3);
65 parse(orderByClause);
66 }
67
68 /**
69 * Reverse the ascending/descending order on all the properties.
70 */
71 public void reverse() {
72 for (Property aList : list) {
73 aList.reverse();
74 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…