package com.liquidnet.service;

/**
 * Created by Administrator on 2017/2/7.
 */
import java.io.Serializable;

public class OrderBy implements Serializable {

    private static final String ASC = "asc";
    private static final String DESC = "desc";
    private String fieldName;
    private String direction = "desc";

    public OrderBy() {
    }

    public OrderBy(String fieldName, String direction) {
        this.fieldName = fieldName;
        this.direction = direction;
    }

    public static OrderBy buildAsc(String fieldName) {
        return new OrderBy(fieldName, "asc");
    }

    public static OrderBy buildDesc(String fieldName) {
        return new OrderBy(fieldName, "desc");
    }

    public void setFiledName(String fieldName) {
        this.fieldName = fieldName;
    }

    public void useDesc() {
        this.direction = "desc";
    }

    public void useAsc() {
        this.direction = "asc";
    }

    public String getFieldName() {
        return this.fieldName;
    }

    public String getDirection() {
        return this.direction;
    }

}
