com.github.tcurrie.rest.factory.v1.ResponseWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rest.factory Show documentation
Show all versions of rest.factory Show documentation
Simple rest client-server factory, you give it a url, it does the rest!
package com.github.tcurrie.rest.factory.v1;
public class ResponseWrapper {
private T result;
private ExceptionWrapper exception;
private boolean success;
public static ResponseWrapper create(final T result) {
return new ResponseWrapper<>(result, true);
}
public static ResponseWrapper createException(final ExceptionWrapper exception) {
return new ResponseWrapper<>(exception, false);
}
@SuppressWarnings("unused")
private ResponseWrapper() {}
private ResponseWrapper(final ExceptionWrapper exception, final boolean success) {
this.exception = exception;
this.success = success;
}
private ResponseWrapper(final T result, final boolean success) {
this.result = result;
this.success = success;
}
public T getResult() {
return result;
}
public boolean isSuccess() {
return success;
}
public ExceptionWrapper getException() {
return exception;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy