You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by si...@avalon.apache.org on 2004/03/06 22:16:49 UTC
[Apache Avalon Wiki] Updated: AspectsAndHandlers
Date: 2004-03-06T13:16:47
Editor: 81.170.128.235 <>
Wiki: Apache Avalon Wiki
Page: AspectsAndHandlers
URL: http://wiki.apache.org/avalon/AspectsAndHandlers
Less magic!
Change Log:
------------------------------------------------------------------------------
@@ -79,7 +79,8 @@
String[] getHandlers ();
void registerEventListener (Class eventInterface, Object listener);
- Object registerEventProducer (Class eventInterface);
+ void unregisterEventListener (Class eventInterface, Object listener);
+ Iterator getEventListeners (Class eventInterface);
}
}}}
@@ -88,7 +89,7 @@
=== Events ===
-Events are defined via multicast interfaces. For example:
+Events are defined via interfaces. For example:
{{{
interface HandlerEvents {
@@ -105,20 +106,20 @@
}}}
The class will then have the appropriate methods called. A class
-wishing to produce events will create an event producer:
+wishing to produce events will get an Iterator over all listeners
+of a certain type:
{{{
-HandlerEvents handlerEvents =
- (HandlerEvents) Kernel.registerEventProducer( HandlerEvents.class );
+Iterator iter = Kernel.getEventListeners( HandlerEvents.class );
}}}
-The class can then send events by calling methods in the interface:
+The class can then send events by:
{{{
- handlerEvents.handlerAdded("myHandler", handler);
+while (iter.hasNext ()) {
+ ((HandlerEvents) iter.next()).handlerAdded("myHandler", handler);
+}
}}}
-
-This will be a "multicast method".
=== The Aspect Interface ===
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org