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

com.github.tcurrie.rest.factory.v1.ResponseWrapper Maven / Gradle / Ivy

There is a newer version: 0.2.70
Show newest version
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