zoukankan      html  css  js  c++  java
  • Result || IResult

    package com.credithc;

    import com.fasterxml.jackson.annotation.JsonAutoDetect;

    @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
    public class Result<T> implements IResult<T> {

    protected T data;
    protected int code;

    protected String msg;
    /**
    * 执行成功
    */
    public static final int OK = 0;

    /**
    * 执行失败
    */
    public static final int FAIL = 1;

    public static final String MSG_SUCCESS= "SUCCESS";

    public Result() {

    }

    public Result(T data) {
    super();
    this.data = data;
    this.code = OK;
    this.msg = MSG_SUCCESS;
    }

    public Result(T data, int code) {
    super();
    this.data = data;
    this.code = code;
    }
    public Result(T data, int code,String msg) {
    super();
    this.data = data;
    this.code = code;
    this.msg=msg;
    }

    public T getData() {
    return data;
    }

    public void setData(T data) {
    this.data = data;
    }

    public int getCode() {
    return code;
    }

    public void setCode(int code) {
    this.code = code;
    }

    public boolean oked() {
    // TODO Auto-generated method stub
    return this.code == OK;
    }

    public boolean failed() {
    // TODO Auto-generated method stub
    return this.code == FAIL;
    }

    public String getMsg() {
    return msg;
    }

    public void setMsg(String msg) {
    this.msg = msg;
    }

    }

    //***********************************************

    package com.credithc;

    import java.io.Serializable;


    public interface IResult<T> extends Serializable {
    public T getData();
    public int getCode();
    public boolean oked();
    public boolean failed();

    }

  • 相关阅读:
    JavaScript高度和宽度详解
    VC6程序图标
    VC++中的Dlg,App,Doc,view
    Vista桌面图标无法拖动
    VC2008中IE8脚本错误问题解决
    单文件安装包制作(转)
    AutoResetEvent与ManualResetEvent区别
    纯JavaScript中调用WebServices
    动态加载程序集Assembly.Load
    VC++小知识积累
  • 原文地址:https://www.cnblogs.com/kekang/p/5609976.html
Copyright © 2011-2022 走看看