public interface CallAdapter<R,T>
| Modifier and Type | Interface and Description |
|---|---|
static class |
CallAdapter.Factory
Creates
CallAdapter instances based on the return type of the service interface methods. |
| Modifier and Type | Method and Description |
|---|---|
T |
adapt(Call<R> call)
Returns an instance of
T which delegates to call. |
Type |
responseType()
Returns the value type that this adapter uses when converting the HTTP response body to a Java
object.
|
Type responseType()
Call<Repo> is Repo. This type
is used to prepare the call passed to #adapt.
Note: This is typically not the same type as the returnType provided to this call
adapter's factory.
T adapt(Call<R> call)
T which delegates to call.
For example, given an instance for a hypothetical utility, Async, this instance would
return a new Async<R> which invoked call when run.
@Override
public <R> Async<R> adapt(final Call<R> call) {
return Async.create(new Callable<Response<R>>() {
@Override
public Response<R> call() throws Exception {
return call.execute();
}
});
}
Copyright © 2017 Square, Inc.. All rights reserved.