Class Java8CallAdapterFactory

java.lang.Object
retrofit2.CallAdapter.Factory
retrofit2.adapter.java8.Java8CallAdapterFactory

@Deprecated
public final class Java8CallAdapterFactory
extends retrofit2.CallAdapter.Factory
Deprecated.
Retrofit includes support for CompletableFuture. This no longer needs to be added to the Retrofit instance explicitly.

A call adapter which creates Java 8 futures.

Adding this class to Retrofit allows you to return CompletableFuture from service methods.


 interface MyService {
   @GET("user/me")
   CompletableFuture<User> getUser()
 }
 
There are two configurations supported for the CompletableFuture type parameter:
  • Direct body (e.g., CompletableFuture<User>) returns the deserialized body for 2XX responses, sets HttpException errors for non-2XX responses, and sets IOException for network errors.
  • Response wrapped body (e.g., CompletableFuture<Response<User>>) returns a Response object for all HTTP responses and sets IOException for network errors
  • Method Summary

    Modifier and Type Method Description
    static Java8CallAdapterFactory create()
    Deprecated.
     
    retrofit2.CallAdapter<?,​?> get​(java.lang.reflect.Type returnType, java.lang.annotation.Annotation[] annotations, retrofit2.Retrofit retrofit)
    Deprecated.
     

    Methods inherited from class retrofit2.CallAdapter.Factory

    getParameterUpperBound, getRawType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static Java8CallAdapterFactory create()
      Deprecated.
    • get

      @Nullable public retrofit2.CallAdapter<?,​?> get​(java.lang.reflect.Type returnType, java.lang.annotation.Annotation[] annotations, retrofit2.Retrofit retrofit)
      Deprecated.
      Specified by:
      get in class retrofit2.CallAdapter.Factory