Class Event<T>

Type Parameters:
T - The listener type.

public abstract class Event<T>
extends Object
Base class for Event implementations.
See Also:
  • Field Summary

    Modifier and Type Field Description
    protected T invoker
    The invoker field.
  • Constructor Summary

    Constructor Description
  • Method Summary

    Modifier and Type Method Description
    T invoker()
    Returns the invoker instance.
    abstract void register​(T listener)
    Register a listener to the event.

    Methods inherited from class java.lang.Object

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

    • invoker

      protected T invoker
      The invoker field. This should be updated by the implementation to always refer to an instance containing all code that should be executed upon event emission.
  • Constructor Details

    • Event

      public Event()
  • Method Details

    • invoker

      public final T invoker()
      Returns the invoker instance.

      An "invoker" is an object which hides multiple registered listeners of type T under one instance of type T, executing them and leaving early as necessary.

      The invoker instance.
    • register

      public abstract void register​(T listener)
      Register a listener to the event.
      listener - The desired listener.