public class PostDownloadHandler extends java.lang.Object implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
private java.util.function.Consumer<java.util.Collection<java.lang.Object>> |
errorReporter |
private java.util.concurrent.Future<?> |
future |
private static java.util.Set<java.lang.String> |
NO_DATA_ERROR_MESSAGES |
private DownloadTask |
task |
Constructor and Description |
---|
PostDownloadHandler(DownloadTask task,
java.util.concurrent.Future<?> future)
Creates a new
PostDownloadHandler |
PostDownloadHandler(DownloadTask task,
java.util.concurrent.Future<?> future,
java.util.function.Consumer<java.util.Collection<java.lang.Object>> errorReporter)
Creates a new
PostDownloadHandler using a custom error reporter |
Modifier and Type | Method and Description |
---|---|
static boolean |
addNoDataErrorMessage(java.lang.String message)
Adds a new translated error message indicating that no data has been downloaded.
|
static boolean |
isNoDataErrorMessage(java.lang.Object message)
Determines if a translated error message indicates that no data has been downloaded.
|
void |
run() |
private final DownloadTask task
private final java.util.concurrent.Future<?> future
private java.util.function.Consumer<java.util.Collection<java.lang.Object>> errorReporter
private static final java.util.Set<java.lang.String> NO_DATA_ERROR_MESSAGES
public PostDownloadHandler(DownloadTask task, java.util.concurrent.Future<?> future)
PostDownloadHandler
task
- the asynchronous download taskfuture
- the future on which the completion of the download task can be synchronizedpublic PostDownloadHandler(DownloadTask task, java.util.concurrent.Future<?> future, java.util.function.Consumer<java.util.Collection<java.lang.Object>> errorReporter)
PostDownloadHandler
using a custom error reportertask
- the asynchronous download taskfuture
- the future on which the completion of the download task can be synchronizederrorReporter
- a callback to inform about the number errors happened during the download
taskpublic static boolean addNoDataErrorMessage(java.lang.String message)
message
- new translated error message indicating that no data has been downloaded.true
if the message was not already knownpublic static boolean isNoDataErrorMessage(java.lang.Object message)
message
- translated error message to checktrue
if the message indicates that no data has been downloadedpublic void run()
run
in interface java.lang.Runnable