org.ops4j.pax.web.extender.whiteboard.internal.util
Class ServicePropertiesUtils

java.lang.Object
  extended by org.ops4j.pax.web.extender.whiteboard.internal.util.ServicePropertiesUtils

public class ServicePropertiesUtils
extends java.lang.Object

Utilities related to service properties.

Since:
0.4.0, March 16, 2008
Author:
Alin Dreghiciu

Method Summary
static java.lang.String getStringProperty(org.osgi.framework.ServiceReference serviceReference, java.lang.String key)
          Returns a property as String.
static java.util.Map<java.lang.String,java.lang.Object> getSubsetStartingWith(org.osgi.framework.ServiceReference serviceReference, java.lang.String prefix)
          Returns the subset of properties that start with the prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getStringProperty

public static java.lang.String getStringProperty(org.osgi.framework.ServiceReference serviceReference,
                                                 java.lang.String key)
Returns a property as String.

Parameters:
serviceReference - service reference; cannot be null
key - property key; canot be null
Returns:
property value; null if property is not set or property value is not a String
Throws:
org.ops4j.lang.NullArgumentException - - If service reference is null - If key is null

getSubsetStartingWith

public static java.util.Map<java.lang.String,java.lang.Object> getSubsetStartingWith(org.osgi.framework.ServiceReference serviceReference,
                                                                                     java.lang.String prefix)
Returns the subset of properties that start with the prefix. The returned dictionary will have as keys the original key without the prefix.

Parameters:
serviceReference - service reference; cannot be null
prefix - property keys prefix; cannot be null
Returns:
subset of properties or null if there is no property that starts with expected prefix


Copyright © 2006-2011 OPS4J - Open Participation Software for Java. All Rights Reserved.