Package org.osgi.service.event
Class EventProperties
- java.lang.Object
-
- org.osgi.service.event.EventProperties
-
public class EventProperties extends Object implements Map<String,Object>
The properties for anEvent
. 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 typeObject
. The key "event.topics" is ignored as event topics can only be set when anEvent
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
-
-
Constructor Summary
Constructors Constructor Description EventProperties(Map<String,?> properties)
Create an EventProperties from the specified properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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.Set<Map.Entry<String,Object>>
entrySet()
Return the property entries.boolean
equals(Object object)
Compares thisEventProperties
object to another object.Object
get(Object name)
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.Set<String>
keySet()
Return the names of the properties.Object
put(String key, Object value)
This method throwsUnsupportedOperationException
.void
putAll(Map<? extends String,? extends Object> map)
This method throwsUnsupportedOperationException
.Object
remove(Object key)
This method throwsUnsupportedOperationException
.int
size()
Return the number of properties.String
toString()
Returns the string representation of this object.Collection<Object>
values()
Return the properties values.-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
EventProperties
public EventProperties(Map<String,?> properties)
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 Detail
-
clear
public void clear()
This method throwsUnsupportedOperationException
.- Specified by:
clear
in interfaceMap<String,Object>
- Throws:
UnsupportedOperationException
- if called.
-
containsKey
public boolean containsKey(Object name)
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
public boolean containsValue(Object value)
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.
-
isEmpty
public boolean isEmpty()
Indicate if this properties is empty.
-
put
public Object put(String key, Object value)
This method throwsUnsupportedOperationException
.- Specified by:
put
in interfaceMap<String,Object>
- Throws:
UnsupportedOperationException
- if called.
-
putAll
public void putAll(Map<? extends String,? extends Object> map)
This method throwsUnsupportedOperationException
.- Specified by:
putAll
in interfaceMap<String,Object>
- Throws:
UnsupportedOperationException
- if called.
-
remove
public Object remove(Object key)
This method throwsUnsupportedOperationException
.- Specified by:
remove
in interfaceMap<String,Object>
- Throws:
UnsupportedOperationException
- if called.
-
size
public int size()
Return the number of properties.
-
values
public Collection<Object> values()
Return the properties values.
-
equals
public boolean equals(Object object)
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.
-
-