Class ListenerList<T>

All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, List<T>, RandomAccess

public class ListenerList<T> extends AutowiredList<T>
Thread-safe listener list with lambda event support. Uses weak references to listeners so that there is no need to explicitly unregister the listeners.
Since:
1.0
Version:
2022-08-31
See Also:
  • Constructor Details

    • ListenerList

      public ListenerList()
      Creates a new empty listener list.
    • ListenerList

      public ListenerList(Collection<T> listeners)
      Creates a new listener list containing the specified list of listeners.
      Parameters:
      listeners - the list of listeners to add
  • Method Details

    • fireEvent

      public void fireEvent(ListenerCaller<T> caller)
      Fires an event to listeners of the specified class.
    • fireEvent

      public <S extends T> void fireEvent(Class<S> clazz, ListenerCaller<S> caller)
      Fires an event to listeners of the specified class.