Class KriptonXLiveDataHandlerImpl<T>

java.lang.Object
com.abubusoft.kripton.androidx.livedata.KriptonXLiveDataHandlerImpl<T>
Type Parameters:
T - The type of the live data
All Implemented Interfaces:
LiveDataHandler

public abstract class KriptonXLiveDataHandlerImpl<T>
extends java.lang.Object
implements LiveDataHandler
A LiveData class that can be invalidated & computed when there are active observers.

It can be invalidated via invalidate(), which will result in a call to compute() if there are active observers (or when they start observing)

This is an internal class for now, might be public if we see the necessity.

  • Constructor Summary

    Constructors 
    Constructor Description
    KriptonXLiveDataHandlerImpl()
    Creates a computable live data that computes values on the arch IO thread executor.
    KriptonXLiveDataHandlerImpl​(java.util.concurrent.Executor executor)
    Creates a computable live data that computes values on the specified executor.
  • Method Summary

    Modifier and Type Method Description
    protected abstract T compute()  
    KriptonXLiveData<T> getLiveData()
    Returns the LiveData managed by this class.
    void invalidate()
    Invalidates the LiveData.

    Methods inherited from class java.lang.Object

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

    • KriptonXLiveDataHandlerImpl

      public KriptonXLiveDataHandlerImpl()
      Creates a computable live data that computes values on the arch IO thread executor.
    • KriptonXLiveDataHandlerImpl

      public KriptonXLiveDataHandlerImpl​(@NonNull java.util.concurrent.Executor executor)
      Creates a computable live data that computes values on the specified executor.
      Parameters:
      executor - Executor that is used to compute new LiveData values.
  • Method Details