EventListener<T,R> Interface
Type Parameters
- T
the event source object type
- R
the event argument type
public interface EventListener<T,R>
This interface provides a simple event-handling method. It allows listeners to be registered to methods through the use of lambda expressions (available in Java 8). Because lambda expressions and anonymous classes allow implicit capture of variables in the enclosing scope, it is important to remember to either use WeakReferences or always ensure to call EventSubscription.cancel to ensure proper cleanup of resources.
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
onEvent(T eventSource, R arg)
This method handles the event that was raised. |
Method Details
onEvent
public void onEvent(T eventSource, R arg)
This method handles the event that was raised.
Parameters: