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

com.quali.cloudshell.api.ResponseData Maven / Gradle / Ivy

The newest version!
package com.quali.cloudshell.api;

//import groovy.transform.builder.Builder;

import java.io.Serializable;

/**
 * Created by shay-k on 21/06/2017.
 */
//@Builder
public class ResponseDataimplements Serializable {

    private T data;
    private int statusCode;
    private String error;
    private String message;

    public T getData() {
        return data;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public String getError() {
        return error;
    }


    private ResponseData(int statusCode){
        this.statusCode = statusCode;
    }

    private ResponseData(T data, int statusCode){
        this.data = data;
        this.statusCode = statusCode;
    }
    private ResponseData(int statusCode, String error){
        this.statusCode = statusCode;
        this.error = error;
    }

    public static  ResponseData ok(T data, int statusCode){
        return new ResponseData(data,statusCode);
    }

    public static  ResponseData error(int statusCode, String error){
        return new ResponseData(statusCode,error);
    }

    public boolean isSuccessful(){
        return this.error == null;
    }


    public String getMessage() {
        return message;
    }

    public  ResponseData setMessage(String message) {
        this.message = message;
        return (ResponseData) this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy