Package org.osgi.service.event
Class EventProperties
java.lang.Object
org.osgi.service.event.EventProperties
The properties for an
Event
. An event source can create an
EventProperties object if it needs to reuse the same event properties for
multiple events.
The keys are all of type String
. The values are of type
Object
. The key "event.topics" is ignored as event topics
can only be set when an Event
is constructed.
Once constructed, an EventProperties object is unmodifiable. However, the values of the map used to construct an EventProperties object are still subject to modification as they are not deeply copied.
- Since:
- 1.3
- "Immutable"
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionEventProperties
(Map<String, ?> properties) Create an EventProperties from the specified properties. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
This method throwsUnsupportedOperationException
.boolean
containsKey
(Object name) Indicates if the specified property is present.boolean
containsValue
(Object value) Indicates if the specified value is present.entrySet()
Return the property entries.boolean
Compares thisEventProperties
object to another object.Return the value of the specified property.int
hashCode()
Returns a hash code value for this object.boolean
isEmpty()
Indicate if this properties is empty.keySet()
Return the names of the properties.This method throwsUnsupportedOperationException
.void
This method throwsUnsupportedOperationException
.This method throwsUnsupportedOperationException
.int
size()
Return the number of properties.toString()
Returns the string representation of this object.values()
Return the properties values.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
EventProperties
Create an EventProperties from the specified properties.The specified properties will be copied into this EventProperties. Properties whose key is not of type
String
will be ignored. A property with the key "event.topics" will be ignored.- Parameters:
properties
- The properties to use for this EventProperties object (may benull
).
-
-
Method Details
-
clear
public void clear()This method throwsUnsupportedOperationException
.- Specified by:
clear
in interfaceMap<String,
Object> - Throws:
UnsupportedOperationException
- if called.
-
containsKey
Indicates if the specified property is present.- Specified by:
containsKey
in interfaceMap<String,
Object> - Parameters:
name
- The property name.- Returns:
true
If the property is present,false
otherwise.
-
containsValue
Indicates if the specified value is present.- Specified by:
containsValue
in interfaceMap<String,
Object> - Parameters:
value
- The property value.- Returns:
true
If the value is present,false
otherwise.
-
entrySet
Return the property entries. -
get
Return the value of the specified property. -
isEmpty
public boolean isEmpty()Indicate if this properties is empty. -
keySet
Return the names of the properties. -
put
This method throwsUnsupportedOperationException
.- Specified by:
put
in interfaceMap<String,
Object> - Throws:
UnsupportedOperationException
- if called.
-
putAll
This method throwsUnsupportedOperationException
.- Specified by:
putAll
in interfaceMap<String,
Object> - Throws:
UnsupportedOperationException
- if called.
-
remove
This method throwsUnsupportedOperationException
.- Specified by:
remove
in interfaceMap<String,
Object> - Throws:
UnsupportedOperationException
- if called.
-
size
public int size()Return the number of properties. -
values
Return the properties values. -
equals
Compares thisEventProperties
object to another object.The properties are compared using the
java.util.Map.equals()
rules which includes identity comparison for array values. -
hashCode
public int hashCode()Returns a hash code value for this object. -
toString
Returns the string representation of this object.
-