public class R<T> extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DEF_ERROR_MESSAGE |
static int |
FAIL_CODE |
static String |
HYSTRIX_ERROR_MESSAGE |
static int |
OPERATION_EX_CODE |
static int |
SUCCESS_CODE |
static int |
TIMEOUT_CODE |
static int |
VALID_EX_CODE
统一参数验证异常
|
| 构造器和说明 |
|---|
R(int code,
T data,
String msg) |
R(int code,
T data,
String msg,
boolean defExec) |
R(int code,
T data,
String msg,
String errorMsg) |
| 限定符和类型 | 方法和说明 |
|---|---|
static <E> R<E> |
fail(BaseExceptionCode exceptionCode) |
static <E> R<E> |
fail(BizException exception) |
static <E> R<E> |
fail(int code,
String msg)
请求失败消息
|
static <E> R<E> |
fail(int code,
String msg,
String errorMsg) |
static <E> R<E> |
fail(String msg) |
static <E> R<E> |
fail(String msg,
Object... args) |
static <E> R<E> |
fail(Throwable throwable)
请求失败消息,根据异常类型,获取不同的提供消息
|
Boolean |
getIsSuccess()
逻辑处理是否成功
|
R<T> |
put(String key,
Object value) |
R<T> |
putAll(Map<Object,Object> extra) |
static <E> R<E> |
result(int code,
E data,
String msg) |
static <E> R<E> |
result(int code,
E data,
String msg,
String errorMsg) |
static R<Boolean> |
success() |
static <E> R<E> |
success(E data)
请求成功消息
|
static <E> R<E> |
success(E data,
String msg)
请求成功方法 ,data返回值,msg提示信息
|
static <E> R<E> |
successDef() |
static <E> R<E> |
successDef(E data) |
static <E> R<E> |
successDef(E data,
String msg) |
static <E> R<E> |
timeout() |
String |
toString() |
static <E> R<E> |
validFail(BaseExceptionCode exceptionCode) |
static <E> R<E> |
validFail(String msg) |
static <E> R<E> |
validFail(String msg,
Object... args) |
public static final int SUCCESS_CODE
public static final int FAIL_CODE
public static final int TIMEOUT_CODE
public static final int VALID_EX_CODE
public static final int OPERATION_EX_CODE
public static <E> R<E> success(E data)
data - 结果public static <E> R<E> successDef(E data)
public static <E> R<E> successDef()
public static <E> R<E> success(E data, String msg)
data - 结果msg - 消息public static <E> R<E> fail(BaseExceptionCode exceptionCode)
public static <E> R<E> fail(BizException exception)
public static <E> R<E> fail(Throwable throwable)
throwable - 异常public static <E> R<E> validFail(BaseExceptionCode exceptionCode)
public static <E> R<E> timeout()
public Boolean getIsSuccess()
Copyright © 2023. All rights reserved.