mirror of https://github.com/tasks/tasks
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
749 B
Java
31 lines
749 B
Java
package com.todoroo.andlib.sql;
|
|
|
|
import static com.todoroo.andlib.sql.Constants.SPACE;
|
|
|
|
public class Order {
|
|
private final Object expression;
|
|
private final OrderType orderType;
|
|
|
|
private Order(Object expression) {
|
|
this(expression, OrderType.ASC);
|
|
}
|
|
|
|
private Order(Object expression, OrderType orderType) {
|
|
this.expression = expression;
|
|
this.orderType = orderType;
|
|
}
|
|
|
|
public static Order asc(Object expression) {
|
|
return new Order(expression);
|
|
}
|
|
|
|
public static Order desc(Object expression) {
|
|
return new Order(expression, OrderType.DESC);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return expression + SPACE + orderType;
|
|
}
|
|
}
|