积木工具箱 发表于 2021-9-24 19:57

Raw use of parameterized class 'Result' 警告

我们项目的公告返回类idea警告 idea警告Raw use of parameterized class 'Result' 这会出现什么问题吗



package com.ppgjx.app.common.result;

import com.ppgjx.app.constant.AnsCodeKey;

/**
* @Descri2021/9/21
* @Autption 公共返回类
** @data hor: LiuBin
* @Modified By:
*/
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;

    Result(Integer code, String msg) {
      this.code = code;
      this.msg = msg;
    }

    Result(Integer code, String msg, T data) {
      this.code = code;
      this.msg = msg;
      this.data = data;
    }

    Result(T data) {
      this.data = data;
    }

    Result(T data, String msg) {
      this.data = data;
      this.msg = msg;
    }

    public Result() {
    }

    public int getCode() {
      return this.code;
    }

    public void setCode(int code) {
      this.code = code;
    }

    public String getMsg() {
      return this.msg;
    }

    public void setMsg(String msg) {
      this.msg = msg;
    }

    public T getData() {
      return this.data;
    }

    public void setData(T data) {
      this.data = data;
    }

    public static Result error(String msg) {
      return new Result(AnsCodeKey.HINT_ERR, msg);
    }

    public static <T> Result<T> error(T data, String msg) {
      return new Result(AnsCodeKey.HINT_ERR, msg, data);
    }

    public static <T> Result<T> success(T data) {
      return new Result(data, "操作成功");
    }

    public static <T> Result<T> success() {
      return new Result(AnsCodeKey.SUCCESS, "操作成功");
    }

    public static <T> Result<T> success(T data, String msg) {
      return new Result(data, msg);
    }

    public static <T> Result<T> common(Integer code, String msg,T data) {
      return new Result(code,msg, data);
    }
}
页: [1]
查看完整版本: Raw use of parameterized class 'Result' 警告