All Downloads are FREE. Search and download functionalities are using the official Maven repository.

top.cutexingluo.tools.common.CommonResult Maven / Gradle / Ivy

There is a newer version: 1.1.6
Show newest version
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