OSGi™ Enterprise
Release 5

org.osgi.service.event
Class EventProperties

java.lang.Object
  extended by 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 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
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
EventProperties(java.util.Map<java.lang.String,?> properties)
          Create an EventProperties from the specified properties.
 
Method Summary
 void clear()
          This method throws UnsupportedOperationException.
 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 this EventProperties 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 throws UnsupportedOperationException.
 void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> map)
          This method throws UnsupportedOperationException.
 java.lang.Object remove(java.lang.Object key)
          This method throws UnsupportedOperationException.
 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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 be null).
Method Detail

clear

public void clear()
This method throws UnsupportedOperationException.

Specified by:
clear in interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 throws UnsupportedOperationException.

Specified by:
put in interface java.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 throws UnsupportedOperationException.

Specified by:
putAll in interface java.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 throws UnsupportedOperationException.

Specified by:
remove in interface java.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 interface java.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 interface java.util.Map<java.lang.String,java.lang.Object>
Returns:
The values of the properties.

equals

public boolean equals(java.lang.Object object)
Compares this EventProperties 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 interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
equals in class java.lang.Object
Parameters:
object - The EventProperties object to be compared.
Returns:
true if object is a EventProperties and is equal to this object; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for this object.

Specified by:
hashCode in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
hashCode in class java.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 class java.lang.Object
Returns:
The string representation of this object.

OSGi™ Enterprise
Release 5

Copyright © OSGi Alliance (2000, 2012). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0