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 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 tocompute()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(Executor executor)Creates a computable live data that computes values on the specified executor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Tcompute()KriptonXLiveData<T>getLiveData()Returns the LiveData managed by this class.voidinvalidate()Invalidates the LiveData.
-
-
-
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:
invalidatein interfaceLiveDataHandler
-
compute
@WorkerThread protected abstract T compute()
-
-