#113 Event Driven Architecture

- refactored and moved around some classes
This commit is contained in:
chris
2015-11-23 00:02:58 +01:00
parent eb396217d0
commit 3ef0921f20
13 changed files with 79 additions and 27 deletions
@@ -1,18 +1,23 @@
package com.iluwatar.eda.advanced;
import com.iluwatar.eda.advanced.events.Event;
import com.iluwatar.eda.advanced.framework.Channel;
import com.iluwatar.eda.advanced.framework.DynamicRouter;
import java.util.HashMap;
import java.util.Map;
public class EventDispatcher implements DynamicRouter<Event> {
private Map<Class<? extends Event>, Handler> handlers;
private Map<Class<? extends Event>, Channel> handlers;
public EventDispatcher() {
handlers = new HashMap<Class<? extends Event>, Handler>();
handlers = new HashMap<Class<? extends Event>, Channel>();
}
public void registerChannel(Class<? extends Event> contentType,
Channel<? extends Event> channel) {
handlers.put(contentType, (Handler)channel);
Channel channel) {
handlers.put(contentType, channel);
}
public void dispatch(Event content) {