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.
TypedEventHandler objects are registered with the Framework service
registry and are notified with an event object when an event is sent.
TypedEventHandler objects are expected to reify the type parameter
T with the type of object they wish to receive when implementing this
interface. This type can be overridden using the
TypedEventConstants.TYPED_EVENT_TOPICS service property.
TypedEventHandler objects may be registered with a service property
TypedEventConstants.TYPED_EVENT_TOPICS whose 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
Modifier and TypeMethodDescriptionvoidCalled by theTypedEventBusservice to notify the listener of an event.
-
Method Details
-
notify
Called by theTypedEventBusservice to notify the listener of an event.- Parameters:
topic- The topic to which the event was sentevent- The event that occurred.
-