public final class ScalaCallAdapterFactory
extends retrofit2.CallAdapter.Factory
Adding this class to Retrofit allows you to return Future from service
methods.
interface MyService {
@GET("user/me")
Future<User> getUser()
}
There are two configurations supported for the Future type parameter:
Future<User>) returns the deserialized body for 2XX responses,
sets HttpException errors for non-2XX responses, and sets
IOException for network errors.
Future<Response<User>>) returns a Response
object for all HTTP responses and sets IOException for network errors
| Modifier and Type | Method and Description |
|---|---|
static ScalaCallAdapterFactory |
create() |
retrofit2.CallAdapter<?,?> |
get(java.lang.reflect.Type returnType,
java.lang.annotation.Annotation[] annotations,
retrofit2.Retrofit retrofit) |
public static ScalaCallAdapterFactory create()
@Nullable
public retrofit2.CallAdapter<?,?> get(java.lang.reflect.Type returnType,
java.lang.annotation.Annotation[] annotations,
retrofit2.Retrofit retrofit)
get in class retrofit2.CallAdapter.Factory