Class NetworkBoundResourceItem<T>


  • public abstract class NetworkBoundResourceItem<T>
    extends androidx.lifecycle.MediatorLiveData<Resource<T>>
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract Result<T> createNetworkRequest()  
      protected abstract androidx.lifecycle.LiveData<T> loadFromDb()  
      protected void onFetchFailed()  
      protected abstract void saveRequestResult​(T item)  
      void setValue​(Resource<T> newValue)  
      • Methods inherited from class androidx.lifecycle.MediatorLiveData

        addSource, onActive, onInactive, removeSource
      • Methods inherited from class androidx.lifecycle.MutableLiveData

        postValue
      • Methods inherited from class androidx.lifecycle.LiveData

        getValue, hasActiveObservers, hasObservers, observe, observeForever, removeObserver, removeObservers
      • Methods inherited from class java.lang.Object

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

      • dbSource

        protected androidx.lifecycle.LiveData<T> dbSource
    • Constructor Detail

      • NetworkBoundResourceItem

        @MainThread
        public NetworkBoundResourceItem​(@NonNull
                                        AppExecutors appExecutors)
    • Method Detail

      • setValue

        @MainThread
        public void setValue​(Resource<T> newValue)
        Overrides:
        setValue in class androidx.lifecycle.MutableLiveData<Resource<T>>
      • saveRequestResult

        @WorkerThread
        protected abstract void saveRequestResult​(@NonNull
                                                  T item)
      • loadFromDb

        @MainThread
        protected abstract androidx.lifecycle.LiveData<T> loadFromDb()
      • createNetworkRequest

        @MainThread
        protected abstract Result<T> createNetworkRequest()
      • onFetchFailed

        @MainThread
        protected void onFetchFailed()