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

com.lvonce.artist.Response Maven / Gradle / Ivy

There is a newer version: 0.1.17
Show newest version
package com.lvonce.artist;

import lombok.Data;

@Data
@SuppressWarnings("unused")
public class Response {
    boolean success;
    int errorCode;   // business error and program error(500)
    String errorMsg;
    T data;

    private Response(boolean success, int errorCode, String errorMsg, T data) {
        this.success = success;
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
        this.data = data;
    }

    public static  Response of(T data) {
        return new Response<>(true, 0, "", data);
    }

    public static  Response ofError(int errorCode, String errorMsg) {
        return new Response<>(false, errorCode, errorMsg, null);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy