Package hu.akarnokd.rxjava3.retrofit
Class Result<T>
- java.lang.Object
-
- hu.akarnokd.rxjava3.retrofit.Result<T>
-
- Type Parameters:
T- the value type of the result
public final class Result<T> extends java.lang.ObjectThe result of executing an HTTP request.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable java.lang.Throwableerror()The error experienced while attempting to execute an HTTP request.static <T> Result<T>error(java.lang.Throwable error)booleanisError()trueif the request resulted in an error.@Nullable retrofit2.Response<T>response()The response received from executing an HTTP request.static <T> Result<T>response(retrofit2.Response<T> response)
-
-
-
Method Detail
-
error
public static <T> Result<T> error(java.lang.Throwable error)
-
response
public static <T> Result<T> response(retrofit2.Response<T> response)
-
response
@Nullable public @Nullable retrofit2.Response<T> response()
The response received from executing an HTTP request. Only present whenisError()is false, null otherwise.- Returns:
- the response object
-
error
@Nullable public @Nullable java.lang.Throwable error()
The error experienced while attempting to execute an HTTP request. Only present whenisError()is true, null otherwise.If the error is an
IOExceptionthen there was a problem with the transport to the remote server. Any other exception type indicates an unexpected failure and should be considered fatal (configuration error, programming error, etc.).- Returns:
- the Throwable error
-
isError
public boolean isError()
trueif the request resulted in an error. Seeerror()for the cause.- Returns:
trueif the request resulted in an error
-
-