|
|
|
@ -16,35 +16,35 @@ public class Response<T> { |
|
|
|
|
this.data = data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public int getCode() { |
|
|
|
|
return code; |
|
|
|
|
public static <T> Response<T> success(T data) { |
|
|
|
|
return new Response<>(ResponseCode.SUCCESS.getCode(), "success", data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getMessage() { |
|
|
|
|
return message; |
|
|
|
|
public static <T> Response<T> success() { |
|
|
|
|
return success(null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public T getData() { |
|
|
|
|
return data; |
|
|
|
|
public static <T> Response<T> error(int code, String message) { |
|
|
|
|
return new Response<>(code, message, null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static<T> Response<T> success(T data) { |
|
|
|
|
return new Response<>(ResponseCode.SUCCESS.getCode(), "success", data); |
|
|
|
|
public static <T> Response<T> error(ResponseCode code, String message) { |
|
|
|
|
return error(code.getCode(), message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static<T> Response<T> success() { |
|
|
|
|
return success(null); |
|
|
|
|
public static <T> Response<T> error(ResponseCode code) { |
|
|
|
|
return error(code, code.getMessage()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static<T> Response<T> error(int code, String message) { |
|
|
|
|
return new Response<>(code, message, null); |
|
|
|
|
public int getCode() { |
|
|
|
|
return code; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static<T> Response<T> error(ResponseCode code, String message) { |
|
|
|
|
return error(code.getCode(), message); |
|
|
|
|
public String getMessage() { |
|
|
|
|
return message; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static<T> Response<T> error(ResponseCode code) { |
|
|
|
|
return error(code, code.getMessage()); |
|
|
|
|
public T getData() { |
|
|
|
|
return data; |
|
|
|
|
} |
|
|
|
|
} |