Class Port<T>
- java.lang.Object
-
- edu.ubo.satellitebeacons.main.event.chanel.Port<T>
-
-
Constructor Summary
Constructors Constructor Description Port()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <E extends java.util.EventObject>
Listener<E>addEventListener(java.lang.Class<E> event, Listener<E> l)
Add a new event listener.<E extends java.util.EventObject>
Listener<E>removeEventListener(java.lang.Class<E> event, Listener<E> l)
Remove a listener.
Warning this method is optional.void
send(T content)
Send a new message to all listeners.
-
-
-
Method Detail
-
send
public void send(T content)
Send a new message to all listeners.- Parameters:
content
- Content of the sending message.
-
addEventListener
public <E extends java.util.EventObject> Listener<E> addEventListener(java.lang.Class<E> event, Listener<E> l)
Description copied from interface:Emitter
Add a new event listener. The listener will be call every time where the event is emitted.- Specified by:
addEventListener
in interfaceEmitter
- Type Parameters:
E
- Any event based on EventObject.- Parameters:
event
- Event that will be listened to.l
- Listener to call when the event is emitted.- Returns:
- The listener if it is correctly registered otherwise
null
.
-
removeEventListener
public <E extends java.util.EventObject> Listener<E> removeEventListener(java.lang.Class<E> event, Listener<E> l)
Description copied from interface:Emitter
Remove a listener.
Warning this method is optional.- Specified by:
removeEventListener
in interfaceEmitter
- Type Parameters:
E
- Any event based on EventObject.- Parameters:
event
- Event where the listener listen.l
- Reference to the listener method.- Returns:
- The listener if it is correctly removed otherwise
null
.
-
-