top.cutexingluo.tools.common.CommonResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xingtools-core Show documentation
Show all versions of xingtools-core Show documentation
xingtools 核心,包括各种接口,实体类和工具类
package top.cutexingluo.tools.common;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.NotNull;
import top.cutexingluo.tools.common.base.IResult;
import top.cutexingluo.tools.common.base.IResultSource;
/**
* IResultSource 实现类,基本封装类
* 目的是统一四大 IResult 实现类,并且提供通用数据结构体
*
* @author XingTian
* @version 1.0.0
* @date 2023/12/8 23:31
* @since 1.0.3
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CommonResult implements IResultSource {
protected C code;
protected String msg;
protected T data;
public CommonResult(@NotNull IResult result) {
this.code = result.getCode();
this.msg = result.getMsg();
this.data = result.getData();
}
@Override
public String getMsg() {
return msg;
}
@Override
public T getData() {
return data;
}
@Override
public C getCode() {
return code;
}
@Override
public CommonResult setCode(C code) {
this.code = code;
return this;
}
@Override
public CommonResult setMsg(String msg) {
this.msg = msg;
return this;
}
@Override
public CommonResult setData(T data) {
this.data = data;
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy