|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.sling.commons.osgi.OsgiUtil
public class OsgiUtil
The OsgiUtil
is a utility class providing some usefull utility
methods.
Constructor Summary | |
---|---|
OsgiUtil()
|
Method Summary | |
---|---|
static org.osgi.service.event.Event |
createEvent(org.osgi.framework.Bundle sourceBundle,
org.osgi.framework.ServiceReference sourceService,
java.lang.String eventName,
java.util.Map<java.lang.String,java.lang.Object> props)
|
static double |
getProperty(java.lang.Object propValue,
double defaultValue)
Deprecated. since 2.0.4, use toDouble(Object, double) instead |
static boolean |
toBoolean(java.lang.Object propValue,
boolean defaultValue)
Returns the boolean value of the named service reference property or the defaultValue if no such service reference property exist. |
static double |
toDouble(java.lang.Object propValue,
double defaultValue)
Returns the named service reference property as a double or the defaultValue if no such reference property exists or if
the property is not an Double and cannot be converted to
an Double from the property's string value. |
static int |
toInteger(java.lang.Object propValue,
int defaultValue)
Returns the named service reference property as an integer or the defaultValue if no such reference property exists or if
the property is not an Integer and cannot be converted to
an Integer from the property's string value. |
static long |
toLong(java.lang.Object propValue,
long defaultValue)
Returns the named service reference property as a long or the defaultValue if no such reference property exists or if
the property is not an Integer and cannot be converted to
a Long from the property's string value. |
static java.lang.Object |
toObject(java.lang.Object propValue)
Returns the named service reference property as a single value. |
static java.lang.String |
toString(java.lang.Object propValue,
java.lang.String defaultValue)
Returns the named service reference property as a string or the defaultValue if no such reference property exists. |
static java.lang.String[] |
toStringArray(java.lang.Object propValue)
Returns the named service reference property as an array of Strings. |
static java.lang.String[] |
toStringArray(java.lang.Object propValue,
java.lang.String[] defaultArray)
Returns the named service reference property as an array of Strings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OsgiUtil()
Method Detail |
---|
public static boolean toBoolean(java.lang.Object propValue, boolean defaultValue)
defaultValue
if no such service reference property exist.
If the service property is not a Boolean
it is converted
by calling Boolean.valueOf
on the string value of the
property.
public static java.lang.String toString(java.lang.Object propValue, java.lang.String defaultValue)
defaultValue
if no such reference property exists.
public static long toLong(java.lang.Object propValue, long defaultValue)
defaultValue
if no such reference property exists or if
the property is not an Integer
and cannot be converted to
a Long
from the property's string value.
public static int toInteger(java.lang.Object propValue, int defaultValue)
defaultValue
if no such reference property exists or if
the property is not an Integer
and cannot be converted to
an Integer
from the property's string value.
@Deprecated public static double getProperty(java.lang.Object propValue, double defaultValue)
toDouble(Object, double)
instead
defaultValue
if no such reference property exists or if
the property is not an Double
and cannot be converted to
an Double
from the property's string value.
public static double toDouble(java.lang.Object propValue, double defaultValue)
defaultValue
if no such reference property exists or if
the property is not an Double
and cannot be converted to
an Double
from the property's string value.
public static java.lang.Object toObject(java.lang.Object propValue)
java.util.Collection
the
property is returned unmodified. If the property is a non-empty array,
the first array element is returned. If the property is a non-empty
java.util.Collection
, the first collection element is returned.
Otherwise null
is returned.
public static java.lang.String[] toStringArray(java.lang.Object propValue)
null
is
returned.
public static java.lang.String[] toStringArray(java.lang.Object propValue, java.lang.String[] defaultArray)
public static org.osgi.service.event.Event createEvent(org.osgi.framework.Bundle sourceBundle, org.osgi.framework.ServiceReference sourceService, java.lang.String eventName, java.util.Map<java.lang.String,java.lang.Object> props)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |