Class StaleWhileRevalidateCallAdapterFactory

  • All Implemented Interfaces:

    
    public final class StaleWhileRevalidateCallAdapterFactory
    
                        

    Call adapter factory that handles Flow<T>> return types.

    When Retrofit function returns Flow<T>>, stale while revalidate strategy will be used. First, Outcome.Progress will be emitted with stale cached data, while new fresh data will be loaded from the server. Afterwards, Outcome.Success will be emitted with the new fresh server data.

    Factory also handles errors:

    • If a call fails due to network issues, it returns Outcome.Error with NoNetworkException

    • If a call falls due to bad JSON parsing, it returns Outcome.Error with DataParsingException

    • If a call fails due to bad response, it calls supplied errorHandler to parse error response and returns Outcome.Error with CauseException from that handler

    Output will not reflect any cache read fails, but they will be reported to the passed errorReporter.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      <Error class: unknown class><out <Error class: unknown class>, out <Error class: unknown class>> ,kotlin.Array,.)>get(<Error class: unknown class> returnType, Array<out Annotation> annotations, <Error class: unknown class> retrofit)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StaleWhileRevalidateCallAdapterFactory

        StaleWhileRevalidateCallAdapterFactory(ErrorHandler errorHandler, <Error class: unknown class> errorReporter)
    • Method Detail

      • get

         <Error class: unknown class><out <Error class: unknown class>, out <Error class: unknown class>> ,kotlin.Array,.)>get(<Error class: unknown class> returnType, Array<out Annotation> annotations, <Error class: unknown class> retrofit)