Class PostDownloadHandler

  • All Implemented Interfaces:
    java.lang.Runnable

    public class PostDownloadHandler
    extends java.lang.Object
    implements java.lang.Runnable
    The post-download handler notifies user of potential errors that occurred.
    Since:
    2322
    • Field Summary

      Fields 
      Modifier and Type Field 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  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • future

        private final java.util.concurrent.Future<?> future
      • errorReporter

        private java.util.function.Consumer<java.util.Collection<java.lang.Object>> errorReporter
    • Constructor Detail

      • PostDownloadHandler

        public PostDownloadHandler​(DownloadTask task,
                                   java.util.concurrent.Future<?> future)
        Creates a new PostDownloadHandler
        Parameters:
        task - the asynchronous download task
        future - the future on which the completion of the download task can be synchronized
      • PostDownloadHandler

        public 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
        Parameters:
        task - the asynchronous download task
        future - the future on which the completion of the download task can be synchronized
        errorReporter - a callback to inform about the number errors happened during the download task
    • Method Detail

      • addNoDataErrorMessage

        public static boolean addNoDataErrorMessage​(java.lang.String message)
        Adds a new translated error message indicating that no data has been downloaded.
        Parameters:
        message - new translated error message indicating that no data has been downloaded.
        Returns:
        true if the message was not already known
        Since:
        15358
      • isNoDataErrorMessage

        public static boolean isNoDataErrorMessage​(java.lang.Object message)
        Determines if a translated error message indicates that no data has been downloaded.
        Parameters:
        message - translated error message to check
        Returns:
        true if the message indicates that no data has been downloaded
        Since:
        15358
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable