package com.uas.search.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 分页参数
 * 
 * @author suntg
 * @since 2016年8月3日下午9:10:47
 */
public class PageParams implements Serializable {

	/**
	 * 序列号
	 */
	private static final long serialVersionUID = 1L;
	private int page;
	private int size;
	private Map<String, Object> filters;

	public PageParams() {

	}

	public PageParams(int page, int size, Map<String, Object> filters) {
		this.page = page;
		this.size = size;
		this.filters = filters;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public Map<String, Object> getFilters() {
		return filters;
	}

	public void setFilters(Map<String, Object> filters) {
		this.filters = filters;
	}

	public void filter(String key, Object value) {
		if (this.filters == null) {
			this.filters = new HashMap<String, Object>();
		}
		this.filters.put(key, value);
	}

	public void removeFilter(String key) {
		if (this.filters != null) {
			this.filters.remove(key);
		}
	}

	@Override
	public String toString() {
		return "PageParams [page=" + page + ", size=" + size + ", filters=" + filters + "]";
	}

}
