Class CollectionResultListener<E>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected IResultListener<java.util.Collection<E>> delegate
      The delegate result listener.
      protected boolean ignorefailures
      Flag to indicate that failures should be ignored and only valid results returned.
      protected boolean notified
      Flag to indicate that the delegate already has been notified.
      protected static java.lang.Object NULL
      Null object.
      protected int num
      The number of sub listeners to wait for.
      protected java.util.Collection<E> results
      The original result collection.
      protected boolean undone
      The undone flag.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean checkNotify​(E result, java.lang.Exception ex)
      Check if the delegate should be notified.
      void exceptionOccurred​(java.lang.Exception exception)
      Called when an exception occurred.
      void exceptionOccurredIfUndone​(java.lang.Exception exception)
      Called when an exception occurred.
      int getResultCount()
      Get the result count.
      boolean isUndone()
      Get the undone.
      protected void notifyDelegate​(java.lang.Exception exception)
      Notify the delegate.
      void resultAvailable​(E result)
      Called when some result is available.
      void resultAvailableIfUndone​(E result)
      Called when the result is available.
      void setNumber​(int num)
      Set the expected number of results.
      • Methods inherited from class java.lang.Object

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

      • num

        protected int num
        The number of sub listeners to wait for.
      • results

        protected java.util.Collection<E> results
        The original result collection.
      • delegate

        protected IResultListener<java.util.Collection<E>> delegate
        The delegate result listener.
      • notified

        protected boolean notified
        Flag to indicate that the delegate already has been notified.
      • ignorefailures

        protected boolean ignorefailures
        Flag to indicate that failures should be ignored and only valid results returned.
      • undone

        protected boolean undone
        The undone flag.
      • NULL

        protected static final java.lang.Object NULL
        Null object.
    • Constructor Detail

      • CollectionResultListener

        public CollectionResultListener​(IResultListener<java.util.Collection<E>> delegate)
        Create a new collection listener that stops on failures.
        Parameters:
        num - The expected number of results.
        delegate - The delegate result listener.
      • CollectionResultListener

        public CollectionResultListener​(boolean ignorefailures,
                                        IResultListener<java.util.Collection<E>> delegate)
        Create a new collection listener.
        Parameters:
        num - The expected number of results.
        ignorefailures - When set to true failures will be tolerated and just not be added to the result collection.
        delegate - The delegate result listener.
      • CollectionResultListener

        public CollectionResultListener​(int num,
                                        IResultListener<java.util.Collection<E>> delegate)
        Create a new collection listener that stops on failures.
        Parameters:
        num - The expected number of results.
        delegate - The delegate result listener.
      • CollectionResultListener

        public CollectionResultListener​(int num,
                                        boolean ignorefailures,
                                        IResultListener<java.util.Collection<E>> delegate)
        Create a new collection listener.
        Parameters:
        num - The expected number of results.
        ignorefailures - When set to true failures will be tolerated and just not be added to the result collection.
        delegate - The delegate result listener.
    • Method Detail

      • exceptionOccurred

        public void exceptionOccurred​(java.lang.Exception exception)
        Called when an exception occurred.
        Specified by:
        exceptionOccurred in interface IFunctionalExceptionListener
        Parameters:
        exception - The exception.
      • exceptionOccurredIfUndone

        public void exceptionOccurredIfUndone​(java.lang.Exception exception)
        Called when an exception occurred.
        Specified by:
        exceptionOccurredIfUndone in interface IUndoneResultListener<E>
        Parameters:
        exception - The exception.
      • isUndone

        public boolean isUndone()
        Get the undone.
        Returns:
        The undone.
      • getResultCount

        public int getResultCount()
        Get the result count.
        Returns:
        The result count.
      • setNumber

        public void setNumber​(int num)
        Set the expected number of results.
        Parameters:
        num - The expected number of results to set.
      • checkNotify

        protected boolean checkNotify​(E result,
                                      java.lang.Exception ex)
        Check if the delegate should be notified.
      • notifyDelegate

        protected void notifyDelegate​(java.lang.Exception exception)
        Notify the delegate.