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 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(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 void
clear()
This method throwsUnsupportedOperationException
.boolean
containsKey(java.lang.Object name)
Indicates if the specified property is present.boolean
containsValue(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.boolean
equals(java.lang.Object object)
Compares thisEventProperties
object to another object.java.lang.Object
get(java.lang.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.java.util.Set<java.lang.String>
keySet()
Return the names of the properties.java.lang.Object
put(java.lang.String key, java.lang.Object value)
This method throwsUnsupportedOperationException
.void
putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> map)
This method throwsUnsupportedOperationException
.java.lang.Object
remove(java.lang.Object key)
This method throwsUnsupportedOperationException
.int
size()
Return the number of properties.java.lang.String
toString()
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
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 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:
containsKey
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Parameters:
name
- The property name.- Returns:
true
If the property is present,false
otherwise.
-
containsValue
public boolean containsValue(java.lang.Object value)
Indicates if the specified value is present.- Specified by:
containsValue
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Parameters:
value
- The property value.- Returns:
true
If the value is present,false
otherwise.
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
Return the property entries.- Specified by:
entrySet
in 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:
get
in 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:
isEmpty
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Returns:
true
If this properties is empty,false
otherwise.
-
keySet
public java.util.Set<java.lang.String> keySet()
Return the names of the properties.- Specified by:
keySet
in 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:
put
in 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:
putAll
in 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:
remove
in 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:
size
in 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:
values
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Returns:
- The values of the properties.
-
equals
public boolean equals(java.lang.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.- Specified by:
equals
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
equals
in classjava.lang.Object
- Parameters:
object
- TheEventProperties
object to be compared.- Returns:
true
ifobject
is aEventProperties
and is equal to this object;false
otherwise.
-
hashCode
public int hashCode()
Returns a hash code value for this object.- Specified by:
hashCode
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
hashCode
in 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:
toString
in classjava.lang.Object
- Returns:
- The string representation of this object.
-
-