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

cc.jinhx.process.result.BaseResult Maven / Gradle / Ivy

There is a newer version: 1.0.17
Show newest version
package cc.jinhx.process.result;

import cc.jinhx.process.enums.ResultEnums;
import lombok.Data;

import java.io.Serializable;

/**
 * BaseResult
 *
 * @author jinhx
 * @since 2022-03-21
 */
@Data
public class BaseResult implements Serializable {

    private static final long serialVersionUID = 8431670825594478958L;

    private T data;

    private Integer code;

    private String msg;

    private BaseResult(){
    }

    public BaseResult(T data){
        this.data = data;
        this.code = ResultEnums.SUCCESS.getCode();
        this.msg = ResultEnums.SUCCESS.getMsg();
    }

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

    public boolean isSuccess(){
        return ResultEnums.SUCCESS.getCode().equals(this.code);
    }

    public boolean isFail(){
        return !isSuccess();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy