Commit 001cb613 authored by yanzg's avatar yanzg

升级新版本

parent 7d35fcd5
......@@ -109,7 +109,7 @@ public class ResponseResult<T> extends BaseVo {
/**
* 获取结果状态码
*
* @return
* @return 状态码
*/
public String getCode() {
return code;
......@@ -118,7 +118,7 @@ public class ResponseResult<T> extends BaseVo {
/**
* 设置请求结果状态码
*
* @param code
* @param code 状态码
*/
public void setCode(String code) {
this.code = code;
......@@ -127,7 +127,7 @@ public class ResponseResult<T> extends BaseVo {
/**
* 获取结果消息
*
* @return
* @return 消息内容
*/
public String getMessage() {
return message;
......@@ -136,7 +136,7 @@ public class ResponseResult<T> extends BaseVo {
/**
* 设置结果消息
*
* @param message
* @param message 消息
*/
public void setMessage(String message) {
this.message = message;
......@@ -145,7 +145,7 @@ public class ResponseResult<T> extends BaseVo {
/**
* 获取数据
*
* @return
* @return 数据
*/
public T getData() {
return data;
......@@ -154,7 +154,7 @@ public class ResponseResult<T> extends BaseVo {
/**
* 设置数据
*
* @param data
* @param data 数据
*/
public void setData(T data) {
this.data = data;
......@@ -172,7 +172,7 @@ public class ResponseResult<T> extends BaseVo {
/**
* 设置数据源
*
* @param target
* @param target 目标
*/
public void setTarget(Object target) {
this.target = target;
......@@ -203,7 +203,7 @@ public class ResponseResult<T> extends BaseVo {
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public static <T extends Object> ResponseResult<T> result(T data) {
public static <T> ResponseResult<T> result(T data) {
return result(data, false);
}
......@@ -214,7 +214,7 @@ public class ResponseResult<T> extends BaseVo {
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public static <T extends Object> ResponseResult<T> resultAllowNull(T data) {
public static <T> ResponseResult<T> resultAllowNull(T data) {
return result(data, true);
}
......@@ -227,14 +227,14 @@ public class ResponseResult<T> extends BaseVo {
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public static <T extends Object> ResponseResult<T> result(T data, boolean allowNull) {
ResponseResult<T> ret = new ResponseResult<T>();
public static <T> ResponseResult<T> result(T data, boolean allowNull) {
ResponseResult<T> ret = new ResponseResult<>();
ret.setData(data);
initDataStatus(ret, data, allowNull);
return ret;
}
protected static void initDataStatus(ResponseResult ret, Object data, boolean allowNull) {
protected static void initDataStatus(ResponseResult<?> ret, Object data, boolean allowNull) {
if (!allowNull && StringHelper.isEmpty(data)) {
ret.setCode(ResultConstants.RESULT_EMPTY);
ret.setMessage("结果为空");
......@@ -244,7 +244,7 @@ public class ResponseResult<T> extends BaseVo {
}
}
public static final ResponseResult<Object> OK = new ResponseResult();
public static final ResponseResult<?> OK = new ResponseResult<>();
/**
* 处理错误
......@@ -252,7 +252,7 @@ public class ResponseResult<T> extends BaseVo {
* @param target 错误源对象
* @return 处理的错误
*/
public static final ResponseResult<Object> error(Object target) {
public static ResponseResult<?> error(Object target) {
return error(ResultConstants.UNKNOW_ERROR, "未知异常", target);
}
......@@ -263,7 +263,7 @@ public class ResponseResult<T> extends BaseVo {
* @param message 错误消息
* @return 处理的错误
*/
public static final ResponseResult<Object> error(String code, String message) {
public static ResponseResult<?> error(String code, String message) {
return error(code, message, null);
}
......@@ -274,7 +274,7 @@ public class ResponseResult<T> extends BaseVo {
* @param target 错误标记
* @return 处理的错误
*/
public static final ResponseResult<Object> error(String message, Object target) {
public static ResponseResult<?> error(String message, Object target) {
return error(ResultConstants.UNKNOW_ERROR, message, target);
}
......@@ -284,7 +284,7 @@ public class ResponseResult<T> extends BaseVo {
* @param ex 错误消息
* @return 处理的错误
*/
public static final ResponseResult error(Exception ex) {
public static ResponseResult<?> error(Exception ex) {
return ExceptionHelper.getError(ex);
}
......@@ -296,7 +296,7 @@ public class ResponseResult<T> extends BaseVo {
* @param target 错误标记
* @return 处理的错误
*/
public static final ResponseResult<Object> error(String code, String message, Object target) {
public static ResponseResult<?> error(String code, String message, Object target) {
return new ResponseResult<>(code, message, null, target);
}
......@@ -305,11 +305,11 @@ public class ResponseResult<T> extends BaseVo {
*
* @param ex 异常信息
* @param cls 返回类型
* @param <T>
* @param <M>
* @return
* @param <T> 处理空数据的类型
* @param <M> 异常类型
* @return 正常空数据
*/
public static final <T, M extends Exception> T isEmpty(M ex, Class<T> cls) throws M {
public static <T, M extends Exception> T isEmpty(M ex, Class<T> cls) throws M {
if (ex instanceof CodeException) {
CodeException codeException = (CodeException) ex;
if (StringHelper.compare(codeException.getCode(), ResultConstants.RESULT_EMPTY)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment