View Javadoc

1   package com.atlassian.event.internal;
2   
3   import com.atlassian.event.spi.ListenerInvoker;
4   
5   import javax.annotation.Nonnull;
6   
7   /**
8    * {@link #transformAll(Iterable, Object) Transforms} a collection of {@link com.atlassian.event.spi.ListenerInvoker ListenerInvokers}
9    * into another collection of {@code ListenerInvokers} before they are dispatched. This may give implementing classes
10   * the opportunity to, among other things, batch up the asynchronous invokers or perform other interesting
11   * transformations.
12   */
13  public interface InvokerTransformer {
14      /**
15       * Takes a collection of {@link com.atlassian.event.spi.ListenerInvoker ListenerInvokers} and returns a potentially transformed version of
16       * these.
17       * <p>
18       * The only on the returned collection is that it must be non-null. It may have the same, a greater number or
19       * smaller number of elements than the supplied collection and it may contain the original elements or completely
20       * new elements or a combination of both.
21       *
22       * @param invokers the collection of {@code ListenerInvokers} to invoke
23       * @param event    the event the supplied invokers were to be dispatched to and the returned invokers will be
24       *                 dispatched to
25       * @return the potentially transformed collection of {@code ListenerInvokers}
26       */
27      @Nonnull
28      Iterable<ListenerInvoker> transformAll(@Nonnull Iterable<ListenerInvoker> invokers, @Nonnull Object event);
29  }