package com.dayu.qiheonlinelibrary.net; 
 | 
  
 | 
  
 | 
import androidx.annotation.NonNull; 
 | 
import androidx.annotation.Nullable; 
 | 
  
 | 
import okhttp3.Handshake; 
 | 
import okhttp3.Headers; 
 | 
import okhttp3.MediaType; 
 | 
import okhttp3.Protocol; 
 | 
import okhttp3.Request; 
 | 
import okhttp3.Response; 
 | 
import okhttp3.ResponseBody; 
 | 
import okhttp3.internal.connection.Exchange; 
 | 
import okio.BufferedSource; 
 | 
  
 | 
/** 
 | 
 * Copyright (C), 2023, 
 | 
 * Author: zuo 
 | 
 * Date: 2023-03-27 15:17 
 | 
 * Description: 
 | 
 */ 
 | 
public class BaseResponse<T>  { 
 | 
    private int code; 
 | 
    private String msg; 
 | 
    private T data; 
 | 
    private String stackErrorInfo;//堆栈错误描述 
 | 
  
 | 
    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; 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 判断状态码是否是异常值 
 | 
     * 
 | 
     * @return 
 | 
     */ 
 | 
    public boolean isCodeInvalid() { 
 | 
        return code != Constants.SUCCESS; 
 | 
    } 
 | 
  
 | 
    public boolean isSuccess() { 
 | 
        return code == Constants.SUCCESS; 
 | 
    } 
 | 
  
 | 
  
 | 
    public String getStackErrorInfo() { 
 | 
        return stackErrorInfo; 
 | 
    } 
 | 
  
 | 
    public void setStackErrorInfo(String stackErrorInfo) { 
 | 
        this.stackErrorInfo = stackErrorInfo; 
 | 
    } 
 | 
  
 | 
    public T getData() { 
 | 
        return data; 
 | 
    } 
 | 
  
 | 
    public void setData(T data) { 
 | 
        this.data = data; 
 | 
    } 
 | 
  
 | 
  
 | 
} 
 |