All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.allways.base.model.ResponseBean Maven / Gradle / Ivy

There is a newer version: 1.0.4.RELEASE
Show newest version
package com.allways.base.model;

import java.io.Serializable;

/**
 * 响应结果封装
 *
 * @author lirui
 */
public class ResponseBean implements Serializable {
	public static final long serialVersionUID = 42L;

	public static final int SUCCESS_CODE = 200;
	public static final int FAIL_CODE = 500;

	public static final ResponseBean SUCCESS = new ResponseBean(null);
	public static final ResponseBean FAIL = new ResponseBean(FAIL_CODE, null);

	private int code;
	private String msg;
	private T content;

	public ResponseBean(){}

	public ResponseBean(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}
	public ResponseBean(T content) {
		this.code = SUCCESS_CODE;
		this.content = content;
	}
	
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public T getContent() {
		return content;
	}
	public void setContent(T content) {
		this.content = content;
	}

	@Override
	public String toString() {
		return "ResponseBean [code=" + code + ", msg=" + msg + ", content=" + content + "]";
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy