public class Response<T> extends Object
| Modifier and Type | Field and Description |
|---|---|
static Integer |
C200
完成
|
static Integer |
C204
无内容
|
static Integer |
C300
重定向
|
static Integer |
C400
客户端请求错误
|
static Integer |
C401
未授权
|
static Integer |
C404
请求资源不存在
|
static Integer |
C500
服务器内部错误
|
static Integer |
C501
服务器不支持请求的功能
|
static Integer |
C502
网关错误
|
protected int |
code |
protected T |
data |
protected String |
message |
static String |
RESPONSE_ERROR
请求错误
|
static String |
RESPONSE_OK
请求正常
|
protected String |
status
返回结果状态标识码,ok表示成功,error表示错误
|
| Constructor and Description |
|---|
Response() |
Response(int code) |
Response(int code,
String message) |
Response(int code,
String message,
T data) |
Response(T data) |
| Modifier and Type | Method and Description |
|---|---|
static <T> Response<T> |
error(int code,
String msg) |
static <T> Response<T> |
error(String msg)
失败
|
int |
getCode() |
T |
getData() |
String |
getMessage() |
String |
getStatus() |
static Response |
ok()
成功
|
static <T> Response<T> |
ok(T data)
成功
|
void |
setCode(int code) |
void |
setData(T data) |
void |
setMessage(String message) |
void |
setStatus(String status) |
public static final Integer C200
public static final Integer C204
public static final Integer C300
public static final Integer C400
public static final Integer C401
public static final Integer C404
public static final Integer C500
public static final Integer C501
public static final Integer C502
public static final String RESPONSE_OK
public static final String RESPONSE_ERROR
protected int code
protected String status
protected String message
protected T data
public Response()
public Response(int code)
public Response(int code,
String message)
public Response(T data)
public static <T> Response<T> ok(T data)
public static Response ok()
public int getCode()
public void setCode(int code)
public String getStatus()
public void setStatus(String status)
public String getMessage()
public void setMessage(String message)
public T getData()
public void setData(T data)
Copyright © 2025. All rights reserved.