@Test public void testFireEvent() throws Exception { JEventListeners<JEventListener<?>, JEvent> listeners = Listeners.newEventListenersBuilder().onCallerThread().withHardReferences().create(); final TestEventListener1 l1 = new TestEventListener1(); final TestEventListener2 l2 = new TestEventListener2(); final TestEventListener3 l3 = new TestEventListener3(); listeners.addListener(l1); listeners.addListener(l2); listeners.addListener(l3); listeners.fireEvent(new TestEvent1()); Assert.assertEquals(1, l1.getCount()); Assert.assertEquals(0, l2.getCount()); Assert.assertEquals(0, l3.getCount()); listeners.fireEvent(new TestEvent1()); Assert.assertEquals(2, l1.getCount()); Assert.assertEquals(0, l2.getCount()); Assert.assertEquals(0, l3.getCount()); listeners.fireEvent(new TestEvent2()); Assert.assertEquals(2, l1.getCount()); Assert.assertEquals(1, l2.getCount()); Assert.assertEquals(0, l3.getCount()); listeners.fireEvent(new TestEvent2()); Assert.assertEquals(2, l1.getCount()); Assert.assertEquals(2, l2.getCount()); Assert.assertEquals(0, l3.getCount()); listeners.fireEvent(new TestEvent3()); Assert.assertEquals(2, l1.getCount()); Assert.assertEquals(3, l2.getCount()); Assert.assertEquals(1, l3.getCount()); listeners.fireEvent(new TestEvent3()); Assert.assertEquals(2, l1.getCount()); Assert.assertEquals(4, l2.getCount()); Assert.assertEquals(2, l3.getCount()); }
@Override public void fireEvent(@Nonnull final E event) { fireEvents(Arrays.asList(event)); }
EventListenersImpl implements JEventListeners<L, E> { @Override public void fireEvent(@Nonnull final E event) { fireEvents(Arrays.asList(event)); } }
EventListenersImpl implements JEventListeners<L, E> { @Override public void fireEvent(@Nonnull final E event) { fireEvents(Arrays.asList(event)); } private  EventListenersImpl(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType, int eventThreadsCount); private  EventListenersImpl(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType, @Nullable Executor eventExecutor); }
EventListenersImpl implements JEventListeners<L, E> { @Override public void fireEvent(@Nonnull final E event) { fireEvents(Arrays.asList(event)); } private  EventListenersImpl(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType, int eventThreadsCount); private  EventListenersImpl(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType, @Nullable Executor eventExecutor); @Nonnull static EventListenersImpl<L, JEvent> newSingleThread(@Nonnull JListeners<L> listeners); @Nonnull static EventListenersImpl<L, E> newSingleThread(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType); @Nonnull static EventListenersImpl<L, E> newInstance(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType, int eventThreadsCount); @Nonnull static EventListenersImpl<L, E> newInstance(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType, @Nonnull Executor executor); @Override void fireEvent(@Nonnull final E event); @Override void fireEvents(@Nonnull final Collection<E> events); @Override boolean addListener(@Nonnull L listener); @Override boolean removeListener(@Nonnull L listener); @Override void removeListeners(); }
EventListenersImpl implements JEventListeners<L, E> { @Override public void fireEvent(@Nonnull final E event) { fireEvents(Arrays.asList(event)); } private  EventListenersImpl(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType, int eventThreadsCount); private  EventListenersImpl(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType, @Nullable Executor eventExecutor); @Nonnull static EventListenersImpl<L, JEvent> newSingleThread(@Nonnull JListeners<L> listeners); @Nonnull static EventListenersImpl<L, E> newSingleThread(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType); @Nonnull static EventListenersImpl<L, E> newInstance(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType, int eventThreadsCount); @Nonnull static EventListenersImpl<L, E> newInstance(@Nonnull JListeners<L> listeners, @Nonnull Class<E> baseEventType, @Nonnull Executor executor); @Override void fireEvent(@Nonnull final E event); @Override void fireEvents(@Nonnull final Collection<E> events); @Override boolean addListener(@Nonnull L listener); @Override boolean removeListener(@Nonnull L listener); @Override void removeListeners();  }