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

org.huiche.web.response.BaseResult Maven / Gradle / Ivy

There is a newer version: 1.4.1
Show newest version
package org.huiche.web.response;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.huiche.core.exception.BaseError;

import javax.annotation.Nonnull;
import java.io.Serializable;

/**
 * 默认全局返回结果类
 *
 * @author Maning
 */
@Setter
@Getter
@Accessors(chain = true)
@ToString
public class BaseResult implements Serializable {
    private Integer code;
    private String msg;
    private T data;

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

    public BaseResult() {
    }

    public static BaseResult of(@Nonnull BaseError e) {
        return new BaseResult().setCode(e.code()).setMsg(e.msg());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy