-
- All Implemented Interfaces:
-
com.facebook.datasource.DataSource
@ThreadSafe() public final class SettableDataSource<T extends Object> extends AbstractDataSource<CloseableReference<T>>
A DataSource whose result may be set by a set(CloseableReference<T>) or setException(Throwable) call. It may also be closed.
This data source has no intermediate results - calling set(CloseableReference<T>) means that the data source is finished. </T></T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classSettableDataSource.Companion
-
Method Summary
Modifier and Type Method Description final Booleanset(CloseableReference<T> valueRef)Sets the value of this data source. final BooleansetException(Throwable throwable)Sets the data source to having failed with the given exception. BooleansetProgress(Float progress)Sets the progress. CloseableReference<T>getResult()Gets the result if any, null otherwise. -
Methods inherited from class com.facebook.imagepipeline.datasource.SettableDataSource
close, getExtras, getFailureCause, getProgress, hasFailed, hasMultipleResults, hasResult, isClosed, isFinished, notifyDataSubscriber, notifyProgressUpdate, setExtras, setFailure, setFailure, setResult, setResult, subscribe -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
set
final Boolean set(CloseableReference<T> valueRef)
Sets the value of this data source.
This method will return
trueif the value was successfully set, orfalseif the data source has already been set, failed or closed.Passed CloseableReference is cloned, caller of this method still owns passed reference after the method returns.
- Parameters:
valueRef- closeable reference to the value the data source should hold.
-
setException
final Boolean setException(Throwable throwable)
Sets the data source to having failed with the given exception.
This method will return
trueif the exception was successfully set, orfalseif the data source has already been set, failed or closed.- Parameters:
throwable- the exception the data source should hold.
-
setProgress
Boolean setProgress(Float progress)
Sets the progress.
- Parameters:
progress- the progress in range 0, 1 to be set.
-
-
-
-