This is one of the choices for Assignment 2.
Objectives: Using reflective properties of programming languages - using Dynamic Method Discovery and Invocation
The EventNotifier implementation discussed in Lecture of Week 3 and used in Asignment 1 has a set of limitations: all Subscribers must implement a given interface, which is part of the EventBus API. This interface defines the signature of the accepted "handler" method, which establishes the type of the handler argument to the most general Event type. Subscribers that subscribe to specialized event types must explicitly cast.
The implementation of the EventBus will use Dynamic Method Discovery and Invocation in order to dispatch an event notification to the subscribers (use dynamic invocation by reflection to call the specific handler method).
The EventBus will keep a list of registrations. Each registration is defined by the following tuple: the subscriber object, the subscribed event type, the event handler function, and a filter with filter function, where the filter may also be null. More details about the requirements and possible ways to solutions are presented in slides with details for this assignment.
.