what-the-bank/sources/retrofit2/adapter/rxjava3/Result.java

41 lines
975 B
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package retrofit2.adapter.rxjava3;
import retrofit2.Response;
/* loaded from: classes.dex */
public final class Result<T> {
private final Throwable error;
private final Response<T> response;
public static <T> Result<T> error(Throwable th) {
if (th == null) {
throw new NullPointerException("error == null");
}
return new Result<>(null, th);
}
public static <T> Result<T> response(Response<T> response) {
if (response == null) {
throw new NullPointerException("response == null");
}
return new Result<>(response, null);
}
private Result(Response<T> response, Throwable th) {
this.response = response;
this.error = th;
}
public final Response<T> response() {
return this.response;
}
public final boolean isError() {
return this.error != null;
}
public final Throwable error() {
return this.error;
}
}