public final class Calls
extends java.lang.Object
Call
instances which immediately respond or fail.Modifier and Type | Method and Description |
---|---|
static <T> retrofit2.Call<T> |
defer(java.util.concurrent.Callable<retrofit2.Call<T>> callable)
Invokes
callable once for the returned Call and once for each instance that is
obtained from cloning the returned Call . |
static <T> retrofit2.Call<T> |
failure(java.io.IOException failure)
Creates a failed
Call from failure . |
static <T> retrofit2.Call<T> |
failure(java.lang.Throwable failure)
Creates a failed
Call from failure . |
static <T> retrofit2.Call<T> |
response(retrofit2.Response<T> response) |
static <T> retrofit2.Call<T> |
response(T successValue) |
public static <T> retrofit2.Call<T> defer(java.util.concurrent.Callable<retrofit2.Call<T>> callable)
callable
once for the returned Call
and once for each instance that is
obtained from cloning the returned Call
.public static <T> retrofit2.Call<T> response(@Nullable T successValue)
public static <T> retrofit2.Call<T> response(retrofit2.Response<T> response)
public static <T> retrofit2.Call<T> failure(java.io.IOException failure)
Call
from failure
.public static <T> retrofit2.Call<T> failure(java.lang.Throwable failure)
Call
from failure
.
Note: When invoking execute()
on the returned Call
, if failure
is a RuntimeException
, Error
, or IOException
subtype it is
thrown directly. Otherwise it is "sneaky thrown" despite not being declared.