public final class GuavaCallAdapterFactory extends CallAdapter.Factory
Adding this class to Retrofit allows you to return ListenableFuture from service
methods.
interface MyService {
@GET("user/me")
ListenableFuture<User> getUser()
}
There are two configurations supported for the ListenableFuture type parameter:
ListenableFuture<User>) returns the deserialized body for 2XX
responses, sets HttpException errors for non-2XX responses, and
sets IOException for network errors.ListenableFuture<Response<User>>) returns a
Response object for all HTTP responses and sets IOException for network
errors| Modifier and Type | Method and Description |
|---|---|
static GuavaCallAdapterFactory |
create() |
CallAdapter<?,?> |
get(Type returnType,
Annotation[] annotations,
Retrofit retrofit)
Returns a call adapter for interface methods that return
returnType, or null if it
cannot be handled by this factory. |
getParameterUpperBound, getRawTypepublic static GuavaCallAdapterFactory create()
public CallAdapter<?,?> get(Type returnType, Annotation[] annotations, Retrofit retrofit)
CallAdapter.FactoryreturnType, or null if it
cannot be handled by this factory.get in class CallAdapter.FactoryCopyright © 2017 Square, Inc.. All rights reserved.