mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 21:25:52 +00:00
@@ -1,9 +1,11 @@
|
||||
package com.iluwatar.eda.framework;
|
||||
|
||||
import com.iluwatar.eda.event.Event;
|
||||
|
||||
/**
|
||||
* Channels are delivery points for messages.
|
||||
* Every {@link Channel} is responsible for a single type of message
|
||||
* Channels are delivery points for messages. Every {@link Channel} is responsible for a single type
|
||||
* of message
|
||||
*/
|
||||
public interface Channel<E extends Message> {
|
||||
void dispatch(E message);
|
||||
void dispatch(E message);
|
||||
}
|
||||
+6
-4
@@ -2,10 +2,12 @@ package com.iluwatar.eda.framework;
|
||||
|
||||
/**
|
||||
* A {@link DynamicRouter} is responsible for selecting the proper path of a {@link Message}
|
||||
* Messages can be associated to Channels through the registerChannel method and dispatched by calling
|
||||
* the dispatch method.
|
||||
* Messages can be associated to Channels through the registerChannel method and dispatched by
|
||||
* calling the dispatch method.
|
||||
*/
|
||||
public interface DynamicRouter<E extends Message> {
|
||||
void registerChannel(Class<? extends E> contentType, Channel channel);
|
||||
void dispatch(E content);
|
||||
|
||||
void registerChannel(Class<? extends E> contentType, Channel<?> channel);
|
||||
|
||||
void dispatch(E content);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.iluwatar.eda.framework;
|
||||
|
||||
/**
|
||||
* A {@link Message} is an object with a specific type that is associated to a
|
||||
* specific {@link Channel}
|
||||
* A {@link Message} is an object with a specific type that is associated
|
||||
* to a specific {@link Channel}.
|
||||
*/
|
||||
public interface Message {
|
||||
Class<? extends Message> getType();
|
||||
Class<? extends Message> getType();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user