Package org.osgi.service.event
Class EventProperties
- java.lang.Object
-
- org.osgi.service.event.EventProperties
-
- All Implemented Interfaces:
java.util.Map<java.lang.String,java.lang.Object>
public class EventProperties extends java.lang.Object implements java.util.Map<java.lang.String,java.lang.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(java.util.Map<java.lang.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(java.lang.Object name)Indicates if the specified property is present.booleancontainsValue(java.lang.Object value)Indicates if the specified value is present.java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>>entrySet()Return the property entries.booleanequals(java.lang.Object object)Compares thisEventPropertiesobject to another object.java.lang.Objectget(java.lang.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.java.util.Set<java.lang.String>keySet()Return the names of the properties.java.lang.Objectput(java.lang.String key, java.lang.Object value)This method throwsUnsupportedOperationException.voidputAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> map)This method throwsUnsupportedOperationException.java.lang.Objectremove(java.lang.Object key)This method throwsUnsupportedOperationException.intsize()Return the number of properties.java.lang.StringtoString()Returns the string representation of this object.java.util.Collection<java.lang.Object>values()Return the properties values.
-
-
-
Constructor Detail
-
EventProperties
public EventProperties(java.util.Map<java.lang.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 interfacejava.util.Map<java.lang.String,java.lang.Object>- Throws:
java.lang.UnsupportedOperationException- if called.
-
containsKey
public boolean containsKey(java.lang.Object name)
Indicates if the specified property is present.- Specified by:
containsKeyin interfacejava.util.Map<java.lang.String,java.lang.Object>- Parameters:
name- The property name.- Returns:
trueIf the property is present,falseotherwise.
-
containsValue
public boolean containsValue(java.lang.Object value)
Indicates if the specified value is present.- Specified by:
containsValuein interfacejava.util.Map<java.lang.String,java.lang.Object>- Parameters:
value- The property value.- Returns:
trueIf the value is present,falseotherwise.
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
Return the property entries.- Specified by:
entrySetin interfacejava.util.Map<java.lang.String,java.lang.Object>- Returns:
- A set containing the property name/value pairs.
-
get
public java.lang.Object get(java.lang.Object name)
Return the value of the specified property.- Specified by:
getin interfacejava.util.Map<java.lang.String,java.lang.Object>- Parameters:
name- The name of the specified property.- Returns:
- The value of the specified property.
-
isEmpty
public boolean isEmpty()
Indicate if this properties is empty.- Specified by:
isEmptyin interfacejava.util.Map<java.lang.String,java.lang.Object>- Returns:
trueIf this properties is empty,falseotherwise.
-
keySet
public java.util.Set<java.lang.String> keySet()
Return the names of the properties.- Specified by:
keySetin interfacejava.util.Map<java.lang.String,java.lang.Object>- Returns:
- The names of the properties.
-
put
public java.lang.Object put(java.lang.String key, java.lang.Object value)This method throwsUnsupportedOperationException.- Specified by:
putin interfacejava.util.Map<java.lang.String,java.lang.Object>- Throws:
java.lang.UnsupportedOperationException- if called.
-
putAll
public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> map)
This method throwsUnsupportedOperationException.- Specified by:
putAllin interfacejava.util.Map<java.lang.String,java.lang.Object>- Throws:
java.lang.UnsupportedOperationException- if called.
-
remove
public java.lang.Object remove(java.lang.Object key)
This method throwsUnsupportedOperationException.- Specified by:
removein interfacejava.util.Map<java.lang.String,java.lang.Object>- Throws:
java.lang.UnsupportedOperationException- if called.
-
size
public int size()
Return the number of properties.- Specified by:
sizein interfacejava.util.Map<java.lang.String,java.lang.Object>- Returns:
- The number of properties.
-
values
public java.util.Collection<java.lang.Object> values()
Return the properties values.- Specified by:
valuesin interfacejava.util.Map<java.lang.String,java.lang.Object>- Returns:
- The values of the properties.
-
equals
public boolean equals(java.lang.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.- Specified by:
equalsin interfacejava.util.Map<java.lang.String,java.lang.Object>- Overrides:
equalsin classjava.lang.Object- Parameters:
object- TheEventPropertiesobject to be compared.- Returns:
trueifobjectis aEventPropertiesand is equal to this object;falseotherwise.
-
hashCode
public int hashCode()
Returns a hash code value for this object.- Specified by:
hashCodein interfacejava.util.Map<java.lang.String,java.lang.Object>- Overrides:
hashCodein classjava.lang.Object- Returns:
- An integer which is a hash code value for this object.
-
toString
public java.lang.String toString()
Returns the string representation of this object.- Overrides:
toStringin classjava.lang.Object- Returns:
- The string representation of this object.
-
-