mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-17 20:59:29 +00:00
Event driven architecture refactored.
1. Renamed Message to Event and Event to AbstractEvent 2. Generified Event and Handler 3. Updated EventDispatcher to make unsafe configuration impossible 4. Updated UML diagram accordingly
This commit is contained in:
+3
-4
@@ -22,7 +22,6 @@
|
||||
*/
|
||||
package com.iluwatar.eda.handler;
|
||||
|
||||
import com.iluwatar.eda.event.Event;
|
||||
import com.iluwatar.eda.event.UserUpdatedEvent;
|
||||
import com.iluwatar.eda.framework.Handler;
|
||||
|
||||
@@ -32,9 +31,9 @@ import com.iluwatar.eda.framework.Handler;
|
||||
public class UserUpdatedEventHandler implements Handler<UserUpdatedEvent> {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event message) {
|
||||
public void onEvent(UserUpdatedEvent event) {
|
||||
|
||||
UserUpdatedEvent userUpdatedEvent = (UserUpdatedEvent) message;
|
||||
System.out.printf("User with %s has been Updated!", userUpdatedEvent.getUser().getUsername());
|
||||
System.out.println(String.format(
|
||||
"User '%s' has been Updated!", event.getUser().getUsername()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user