类 Result<T>


  • public class Result<T>
    extends Object
    操作消息提醒
    作者:
    Lion Li
    • 构造器详细资料

      • Result

        public Result​(int code,
                      String msg)
        初始化一个新创建的 Result 对象
        参数:
        code - 状态码
        msg - 返回内容
    • 方法详细资料

      • toJsonStr

        public String toJsonStr()
      • redirect

        public static Result<String> redirect​(String msg,
                                              String path)
        提示信息后直接重定向
        参数:
        msg - 返回内容
        返回:
        警告消息
      • success

        public static <T> Result<T> success()
        操作成功
        返回:
        成功
      • success

        public static <T> Result<T> success​(String msg)
        操作成功
        参数:
        msg - 消息提示
        返回:
        成功
      • success

        public static <T> Result<T> success​(T data)
        操作成功
        参数:
        data - 数据
        返回:
        成功
      • success

        public static <T> Result<T> success​(String msg,
                                            T data)
        操作成功
        参数:
        msg - 消息提示
        data - 数据
        返回:
        成功
      • fail

        public static <T> Result<T> fail()
        操作失败
        返回:
        失败
      • fail

        public static <T> Result<T> fail​(String msg)
        操作失败
        参数:
        msg - 消息提示
        返回:
        失败
      • fail

        public static <T> Result<T> fail​(T data)
        操作失败
        参数:
        data - 数据
        返回:
        失败
      • fail

        public static <T> Result<T> fail​(String msg,
                                         T data)
        操作失败
        参数:
        msg - 消息提示
        data - 数据
        返回:
        失败
      • invalidRequest

        public static <Void> Result<Void> invalidRequest()
        无效的请求
        返回:
        无效的请求
      • noPermission

        public static <Void> Result<Void> noPermission()
        您无权限
        返回:
        您无权限
      • successToast

        public static <Void> Result<Void> successToast​(String msg)
        返回正确消息并弹出提示框
        参数:
        msg - 返回内容
        返回:
        警告消息
      • successToast

        public static <T> Result<T> successToast​(String msg,
                                                 T data)
        返回正确消息并弹出提示框
        参数:
        msg - 返回信息
        data - 返回内容
        返回:
        警告消息
      • failToast

        public static <Void> Result<Void> failToast​(String msg)
        返回错误消息并弹出提示框
        参数:
        msg - 返回内容
        返回:
        警告消息
      • failToast

        public static <T> Result<T> failToast​(String msg,
                                              T data)
        返回错误消息并弹出提示框
        参数:
        msg - 返回信息
        data - 返回内容
        返回:
        警告消息
      • successPopup

        public static <T> Result<T> successPopup​(String msg)
        返回正确消息并弹模态框提示
        参数:
        msg - 返回内容
        返回:
        警告消息
      • successPopup

        public static <T> Result<T> successPopup​(String msg,
                                                 T data)
        返回正确消息并弹模态框提示
        参数:
        msg - 返回内容
        data - 返回内容
        返回:
        警告消息
      • failPopup

        public static <T> Result<T> failPopup​(String msg)
        返回错误消息并弹模态框提示
        参数:
        msg - 返回内容
        返回:
        警告消息