/** * Create a new counter listener. * * @param num The number of sub callbacks. * @param ignorefailures Flag whether to ignore failures. * @param countReachedListener Functional listener called when the count is * reached. */ public CounterResultListener(int num, boolean ignorefailures, IFunctionalResultListener<Void> countReachedListener) { this(num, ignorefailures, SResultListener.createResultListener(countReachedListener)); }
/** * Creates an {@link IResultListener} that delegates results to the given * SuccessListener and uses default exception handling. * * @param sucListener The SuccessListener. * @return {@link IResultListener} */ public static <E> IResultListener<E> createResultListener(final IFunctionalResultListener<E> sucListener) { return createResultListener(sucListener, true); }
/** * Create a new collection listener. * * @param num The expected number of results. * @param ignorefailures When set to true failures will be tolerated and * just not be added to the result collection. * @param resultDelegate The functional delegate result listener. * @param exceptionDelegate The functional delegate exception listener. * Passing <code>null</code> enables default exception logging. */ public CollectionResultListener(boolean ignorefailes, IFunctionalResultListener<Collection<E>> resultDelegate, IFunctionalExceptionListener exceptionDelegate) { this(-1, ignorefailes, SResultListener.createResultListener(resultDelegate, exceptionDelegate)); }
/** * Create a new counter listener. * * @param num The number of sub callbacks. * @param ignorefailures Flag whether to ignore failures. * @param countReachedListener Functional listener called when the count is * reached. * @param exListener The listener that is called on exceptions. Passing * <code>null</code> enables default exception logging. */ public CounterResultListener(int num, boolean ignorefailures, IFunctionalResultListener<Void> countReachedListener, IFunctionalExceptionListener exListener) { this(num, ignorefailures, SResultListener.createResultListener(countReachedListener, exListener)); }
/** * Create a new collection listener. * * @param num The expected number of results. * @param ignorefailures When set to true failures will be tolerated and * just not be added to the result collection. * @param resultDelegate The functional delegate result listener. * @param exceptionDelegate The functional delegate exception listener. * Passing <code>null</code> enables default exception logging. */ public CollectionResultListener(int num, boolean ignorefailes, IFunctionalResultListener<Collection<E>> resultDelegate, IFunctionalExceptionListener exceptionDelegate) { this(num, ignorefailes, SResultListener.createResultListener(resultDelegate, exceptionDelegate)); }
/** * Create a new counter listener. * * @param num The number of sub callbacks. * @param ignorefailures Flag whether to ignore failures. * @param countReachedListener Functional listener called when the count is * reached. * @param intermediateResultListener Functional listener called on * intermediate results, can be <code>null</code>. * @param exListener The listener that is called on exceptions. Passing * <code>null</code> enables default exception logging. */ public CounterResultListener(int num, boolean ignorefailures, IFunctionalResultListener<Void> countReachedListener, IFunctionalResultListener<E> intermediateResultListener, IFunctionalExceptionListener exListener) { this(num, ignorefailures, SResultListener.createResultListener(countReachedListener, exListener)); this.intermediateResultListener = intermediateResultListener; }
/** * Create a new component result listener. * * @param listener The functional listener. * @param exceptionListener The functional exception listener. Maybe * <code>null</code>, which will lead to default exception logging. * @param access External access of the component to schedule the listener * methods on. */ public ComponentResultListener(final IFunctionalResultListener<E> listener, final IFunctionalExceptionListener exceptionListener, IExternalAccess access) { if(listener == null) { throw new NullPointerException("Listener must not be null."); } if(exceptionListener != null) { this.listener = SResultListener.createResultListener(listener, exceptionListener); } else { this.listener = SResultListener.createResultListener(listener); } this.access = access; }
/** * Create a new component result listener. * * @param listener The functional listener. * @param exceptionListener The functional exception listener. Maybe * <code>null</code>, which will lead to default exception logging. * @param adapter The adapter. to schedule the listener methods on. */ public ComponentResultListener(final IFunctionalResultListener<E> listener, final IFunctionalExceptionListener exceptionListener, IInternalAccess component) { if(listener == null) { throw new NullPointerException("Listener must not be null."); } if(exceptionListener != null) { this.listener = SResultListener.createResultListener(listener, exceptionListener); } else { this.listener = SResultListener.createResultListener(listener); } this.component = component; }
/** * Add a result listener by combining an OnSuccessListener and an * OnExceptionListener. * * @param sucListener The listener that is called on success. * @param exListener The listener that is called on exceptions. Passing * <code>null</code> enables default exception logging. */ public void addResultListener(IFunctionalResultListener<E> sucListener, IFunctionalExceptionListener exListener) { addResultListener(SResultListener.createResultListener(sucListener, exListener)); }
/** * Creates an {@link IResultListener} that delegates results to the given * SuccessListener. * * @param sucListener The SuccessListener. * @param defaultExceptionHandling Specifies whether to use a default * handling for exceptions or not. * @return {@link IResultListener} */ public static <E> IResultListener<E> createResultListener(final IFunctionalResultListener<E> sucListener, final boolean defaultExceptionHandling) { if (defaultExceptionHandling) { return createResultListener(sucListener, printExceptions()); } else { return createResultListener(sucListener, ignoreExceptions()); } }