Interface EventHandler<L, E extends EventObject>

Type Parameters:
L - the listener type
E - the event type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface EventHandler<L, E extends EventObject>
A callback invoked by EventManager when an event is dispatched to a registered listener. The listener itself is passed as the first argument, so the handler is normally an unbound method reference such as MyListener::onEvent. An unbound reference captures no state and lets the EventManager hold the listener via a weak reference, releasing the registration once the listener is garbage collected. A lambda or bound reference that captures the listener (e.g. this::onEvent) defeats this and keeps the listener alive for as long as the EventManager is.
Since:
5.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handle(L listener, E event)