Package org.osgi.service.typedevent
Interface TypedEventHandler<T>
-
- Type Parameters:
T- The type of the event to be received
@ConsumerType public interface TypedEventHandler<T>Listener for Typed Events.TypedEventHandlerobjects are registered with the Framework service registry and are notified with an event object when an event is sent.TypedEventHandlerobjects are expected to reify the type parameterTwith the type of object they wish to receive when implementing this interface. This type can be overridden using theTypedEventConstants.TYPED_EVENT_TOPICSservice property.TypedEventHandlerobjects may be registered with a service propertyTypedEventConstants.TYPED_EVENT_TOPICSwhose value is the list of topics in which the event handler is interested.For example:
String[] topics = new String[] { "com/isv/*" }; Hashtable ht = new Hashtable(); ht.put(EventConstants.TYPE_SAFE_EVENT_TOPICS, topics); context.registerService(TypedEventHandler.class, this, ht);- Author:
- $Id: 1ef1b856280d23975dcb3d2d2c5046eb82cdb6fc $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidnotify(java.lang.String topic, T event)Called by theTypedEventBusservice to notify the listener of an event.
-
-
-
Method Detail
-
notify
void notify(java.lang.String topic, T event)Called by theTypedEventBusservice to notify the listener of an event.- Parameters:
topic- The topic to which the event was sentevent- The event that occurred.
-
-