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 anEventis 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 voidclear()This method throwsUnsupportedOperationException.booleancontainsKey(Object name)Indicates if the specified property is present.booleancontainsValue(Object value)Indicates if the specified value is present.Set<Map.Entry<String,Object>>entrySet()Return the property entries.booleanequals(Object object)Compares thisEventPropertiesobject to another object.Objectget(Object name)Return the value of the specified property.inthashCode()Returns a hash code value for this object.booleanisEmpty()Indicate if this properties is empty.Set<String>keySet()Return the names of the properties.Objectput(String key, Object value)This method throwsUnsupportedOperationException.voidputAll(Map<? extends String,? extends Object> map)This method throwsUnsupportedOperationException.Objectremove(Object key)This method throwsUnsupportedOperationException.intsize()Return the number of properties.StringtoString()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
Stringwill 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:
clearin interfaceMap<String,Object>- Throws:
UnsupportedOperationException- if called.
-
containsKey
public boolean containsKey(Object name)
Indicates if the specified property is present.- Specified by:
containsKeyin interfaceMap<String,Object>- Parameters:
name- The property name.- Returns:
trueIf the property is present,falseotherwise.
-
containsValue
public boolean containsValue(Object value)
Indicates if the specified value is present.- Specified by:
containsValuein interfaceMap<String,Object>- Parameters:
value- The property value.- Returns:
trueIf the value is present,falseotherwise.
-
isEmpty
public boolean isEmpty()
Indicate if this properties is empty.
-
put
public Object put(String key, Object value)
This method throwsUnsupportedOperationException.- Specified by:
putin interfaceMap<String,Object>- Throws:
UnsupportedOperationException- if called.
-
putAll
public void putAll(Map<? extends String,? extends Object> map)
This method throwsUnsupportedOperationException.- Specified by:
putAllin interfaceMap<String,Object>- Throws:
UnsupportedOperationException- if called.
-
remove
public Object remove(Object key)
This method throwsUnsupportedOperationException.- Specified by:
removein 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 thisEventPropertiesobject 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.
-
-