java.lang.Object | ||
↳ | com.facebook.datasource.AbstractDataSource<T> | |
↳ | com.facebook.datasource.SimpleDataSource<T> |
Settable DataSource
.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static <T> SimpleDataSource<T> |
create()
Creates a new
SimpleDataSource . | ||||||||||
boolean |
setFailure(Throwable throwable)
Sets the failure.
| ||||||||||
boolean |
setProgress(float progress)
Sets the progress.
| ||||||||||
boolean |
setResult(T value)
Sets the value as the last result.
| ||||||||||
boolean |
setResult(T value, boolean isLast, Map<String, Object> extras)
Sets the result to
value . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.facebook.datasource.AbstractDataSource
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.facebook.datasource.DataSource
|
Sets the failure.
This method will return true
if the failure was successfully set, or false
if the data source has already been set, failed or closed.
If the failure was successfully set, state of the data source will be set to AbstractDataSource.DataSourceStatus#FAILURE.
This will also notify the subscribers if the failure was successfully set.
throwable | the failure cause to be set. |
---|
Sets the progress.
progress | the progress in range [0, 1] to be set. |
---|
Sets the result to value
.
This method will return true
if the value was successfully set, or false
if
the data source has already been set, failed or closed.
If the value was successfully set and isLast
is true
, state of the data
source will be set to AbstractDataSource.DataSourceStatus#SUCCESS.
This will also notify the subscribers if the value was successfully set.
value | the value to be set |
---|---|
isLast | whether or not the value is last. |
extras | an object with extra data for this datasource |