Class KriptonXLiveDataHandlerImpl<T>

  • Type Parameters:
    T - The type of the live data
    All Implemented Interfaces:
    LiveDataHandler

    public abstract class KriptonXLiveDataHandlerImpl<T>
    extends 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 Detail

      • KriptonXLiveDataHandlerImpl

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

        public KriptonXLiveDataHandlerImpl​(@NonNull
                                           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 Detail

      • getLiveData

        @NonNull
        public KriptonXLiveData<T> getLiveData()
        Returns the LiveData managed by this class.
        Returns:
        A LiveData that is controlled by ComputableLiveData.
      • invalidate

        public void invalidate()
        Invalidates the LiveData.

        When there are active observers, this will trigger a call to compute().

        Specified by:
        invalidate in interface LiveDataHandler