CS代考 package dungeonmania.response.models;

package dungeonmania.response.models;

public final class GenericResponseWrapper {
private final T result;

Copyright By PowCoder代写 加微信 powcoder

private final String errorTitle;
private final String errorMessage;
private final boolean isError;

private GenericResponseWrapper(T result) {
this.result = result;
this.errorTitle = this.errorMessage = null;
this.isError = false;

private GenericResponseWrapper(String title, String msg) {
this.result = null;
this.errorTitle = title;
this.errorMessage = msg;
this.isError = true;

public static GenericResponseWrapper ok(T result) {
return new GenericResponseWrapper(result);

public static GenericResponseWrapper err(Exception e) {
return new GenericResponseWrapper(e.getClass().getSimpleName(), e.getLocalizedMessage());

public boolean isError() {
return isError;

public T getResult() {
return result;

public String getErrorTitle() {
return errorTitle;

public String getErrorMessage() {
return errorMessage;

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com