记录一个Result dto类 以后可以方便复制用

Posted 菊花茶

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了记录一个Result dto类 以后可以方便复制用相关的知识,希望对你有一定的参考价值。


public class Result<T> {
private boolean success;

private int status;

private T data;

private String msg;

public Result() {
}

public Result(boolean success, int status, T data, String msg) {
this.success = success;
this.status = status;
this.data = data;
this.msg = msg;
}

public Result(boolean success, int status, String msg) {
this.success = success;
this.status = status;
this.msg = msg;
}

public Result(boolean success, String msg) {
this.success = success;
this.msg = msg;
}

public boolean isSuccess() {
return success;
}

public void setSuccess(boolean success) {
this.success = success;
}

public int getStatus() {
return status;
}

public void setStatus(int status) {
this.status = status;
}

public T getData() {
return data;
}

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

public String getMsg() {
return msg;
}

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

@Override
public String toString() {
return "Result{" +
"success=" + success +
", status=" + status +
", data=" + data +
", msg=‘" + msg + \‘‘ +
‘}‘;
}
}

以上是关于记录一个Result dto类 以后可以方便复制用的主要内容,如果未能解决你的问题,请参考以下文章

使用BeanUtils类实现DTO之间的属性复制

javaEE开发为啥要用到DTO层,该怎么处理

pojo与DTO的区别是啥?

分享几款自己用的图床,picgo搭建

PO VO BO DTO POJO DAO的解释

我应该用Serializable标记spring mvc DTO吗? [复制]