枚举类型
/**
 * 排序控制
* @author Mr.chen 2016-6-1
 */
public class OrderItem {
   
	//列名(对应实体的属性命名规范)
	String columnName;  
	//排序方式
	OrderOption option = OrderOption.DESC;
	public String getColumnName() {
		return columnName;
	}
 
	public String getType() {
		return option.getType();
	}
	public OrderItem(String columnName, OrderOption option) {
		this.columnName = columnName;
		this.option = option;
	}
	/**
	 * 排序枚举类型
	 */
	public enum OrderOption {
		ASC("ASC"),
		DESC("DESC");
		String type;
		
		OrderOption(String type){
			this.type = type;
		}
		public String getType() {
			return type;
		}
		public void setType(String type) {
			this.type = type;
		}
	}
}
public static void main(String[] args) {
List<OrderItem> orderList = new ArrayList<OrderItem>();
orderList.add(new OrderItem("createDate", OrderOption.DESC));
	}
感谢您的阅读,您的支持是我写博客动力。
 
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号