Package org.osgi.service.event
Class Event
java.lang.Object
org.osgi.service.event.Event
An event.
Event objects are delivered to EventHandler
services which subscribe to the topic of the event.- Version:
- $Revision: 7003 $
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares thisEventobject to another object.final ObjectgetProperty(String name) Retrieves a property.final String[]Returns a list of this event's property names.final StringgetTopic()Returns the topic of this event.inthashCode()Returns a hash code value for the object.final booleanmatches(org.osgi.framework.Filter filter) Tests this event's properties against the given filter using a case sensitive match.toString()Returns the string representation of this event.
-
Constructor Details
-
Event
Constructs an event.- Parameters:
topic- The topic of the event.properties- The event's properties (may benull). A property whose key is not of typeStringwill be ignored.- Throws:
IllegalArgumentException- If topic is not a valid topic name.- Since:
- 1.2
-
Event
Constructs an event.- Parameters:
topic- The topic of the event.properties- The event's properties (may benull). A property whose key is not of typeStringwill be ignored.- Throws:
IllegalArgumentException- If topic is not a valid topic name.
-
-
Method Details
-
getProperty
Retrieves a property.- Parameters:
name- the name of the property to retrieve- Returns:
- The value of the property, or
nullif not found.
-
getPropertyNames
Returns a list of this event's property names.- Returns:
- A non-empty array with one element per property.
-
getTopic
Returns the topic of this event.- Returns:
- The topic of this event.
-
matches
public final boolean matches(org.osgi.framework.Filter filter) Tests this event's properties against the given filter using a case sensitive match.- Parameters:
filter- The filter to test.- Returns:
- true If this event's properties match the filter, false otherwise.
-
equals
Compares thisEventobject to another object.An event is considered to be equal to another event if the topic is equal and the properties are equal.
-
hashCode
public int hashCode()Returns a hash code value for the object. -
toString
Returns the string representation of this event.
-