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 Tcompute()KriptonXLiveData<T>getLiveData()Returns the LiveData managed by this class.voidinvalidate()Invalidates the LiveData.
-
Constructor Details
-
KriptonXLiveDataHandlerImpl
public KriptonXLiveDataHandlerImpl()Creates a computable live data that computes values on the arch IO thread executor. -
KriptonXLiveDataHandlerImpl
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
-
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:
invalidatein interfaceLiveDataHandler
-
compute
-