com.quali.cloudshell.api.ResponseData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sandbox-api Show documentation
Show all versions of sandbox-api Show documentation
CloudShell Sandbox java gateway project
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;
}
}