package com.goafanti.common.bo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.shiro.SecurityUtils;
public class Result {
	private Object		data;
	private List<Error>	error	= new ArrayList<Error>();
	private Serializable token;
	public Result() {
		this.token = SecurityUtils.getSubject().getSession().getId();
	}

	public Result(Object data) {
		this.data = data;
	}

	/**
	 * @return the data
	 */
	public Object getData() {
		return data;
	}

	/**
	 * @param data
	 *            the data to set
	 */
	public void setData(Object data) {
		this.data = data;
	}

	/**
	 * @return the error
	 */
	public List<Error> getError() {
		return error;
	}

	/**
	 * @param error
	 *            the error to set
	 */
	public void setError(List<Error> error) {
		this.error = error;
	}

	public Result error(Error e) {
		if (e != null) {
			this.error.add(e);
		}
		return this;
	}

	public Result data(Object o) {
		this.data = o;
		return this;
	}

	public Serializable getToken() {
		return token;
	}

	public void setToken(Serializable token) {
		this.token = token;
	}
}
