java.lang.Object
net.i2p.i2ptunnel.irc.EventReceiver
- All Implemented Interfaces:
EventDispatcher
- Direct Known Subclasses:
DCCClientManager
An implementation of the EventDispatcher interface for receiving events via in-line
notifyEvent(String, Object) only. Does not support chaining to additional dispatchers. Does not support waitEventValue(String). Does not support ignoring.Constructor Summary
ConstructorsConstructorDescriptionConstructor for subclasses that receive events through notifyEvent().Method Summary
Modifier and TypeMethodDescriptionvoidSubscribe to IRC events.voidUnsubscribe from IRC events.Object to be used to deliver events (usuallythis, but YMMV).All registered event names.getEventValue(String name) Value of the last fired event.voidStop waiting for events.abstract voidnotifyEvent(String eventName, Object args) Deliver an event.voidAlmost like the method above :-).waitEventValue(String name) Block until the event fires and return its value.
Constructor Details
EventReceiver
public EventReceiver()Constructor for subclasses that receive events through notifyEvent().
Method Details
getEventDispatcher
Description copied from interface:EventDispatcherObject to be used to deliver events (usuallythis, but YMMV).- Specified by:
getEventDispatcherin interfaceEventDispatcher- Returns:
- the event dispatcher
attachEventDispatcher
Subscribe to IRC events.- Specified by:
attachEventDispatcherin interfaceEventDispatcher- Parameters:
ev- Event object to be attached- Throws:
UnsupportedOperationException- always; the receiver is its own dispatcher
detachEventDispatcher
Unsubscribe from IRC events.- Specified by:
detachEventDispatcherin interfaceEventDispatcher- Parameters:
ev- Event object to be detached- Throws:
UnsupportedOperationException- always; the receiver is its own dispatcher
notifyEvent
Description copied from interface:EventDispatcherDeliver an event.- Specified by:
notifyEventin interfaceEventDispatcher- Parameters:
eventName- name of the eventargs- data being stored for that event
getEventValue
Value of the last fired event.- Specified by:
getEventValuein interfaceEventDispatcher- Parameters:
name- name of the event to query for- Returns:
- never returns, as a receiver stores no event values
- Throws:
UnsupportedOperationException- always; a receiver stores no event values
getEvents
All registered event names.- Specified by:
getEventsin interfaceEventDispatcher- Returns:
- never returns, as the receiver registers no event names
- Throws:
UnsupportedOperationException- always; the registry is never populated
ignoreEvents
public void ignoreEvents()Stop waiting for events.- Specified by:
ignoreEventsin interfaceEventDispatcher- Throws:
UnsupportedOperationException- always; there is nothing to ignore
unIgnoreEvents
public void unIgnoreEvents()Description copied from interface:EventDispatcherAlmost like the method above :-).- Specified by:
unIgnoreEventsin interfaceEventDispatcher
waitEventValue
Block until the event fires and return its value.- Specified by:
waitEventValuein interfaceEventDispatcher- Parameters:
name- name of the event to wait for- Returns:
- value specified for that event
- Throws:
UnsupportedOperationException- always; a receiver cannot block on an event