You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:23:59 UTC

[sling-org-apache-sling-commons-osgi] 20/24: Deprecate getProperty(Object, double) and add toDouble(Object, double) to align with the rest of the toTYPE methods taking the object and the default value.

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.4-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 256d3f47d0b6c50177a2da811cd661e3eb208941
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Mon Apr 6 11:09:36 2009 +0000

    Deprecate getProperty(Object, double) and add toDouble(Object, double) to align
    with the rest of the toTYPE methods taking the object and the default value.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/bundles/commons/osgi@762277 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
index 697738c..b6533a3 100644
--- a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
+++ b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
@@ -110,8 +110,22 @@ public class OsgiUtil {
      * <code>defaultValue</code> if no such reference property exists or if
      * the property is not an <code>Double</code> and cannot be converted to
      * an <code>Double</code> from the property's string value.
+     * 
+     * @deprecated since 2.0.4, use toDouble instead
      */
     public static double getProperty(Object propValue, double defaultValue) {
+        return toDouble(propValue, defaultValue);
+    }
+    
+    /**
+     * Returns the named service reference property as a double or the
+     * <code>defaultValue</code> if no such reference property exists or if
+     * the property is not an <code>Double</code> and cannot be converted to
+     * an <code>Double</code> from the property's string value.
+     * 
+     * @since 2.0.4
+     */
+    public static double toDouble(Object propValue, double defaultValue) {
         propValue = toObject(propValue);
         if (propValue instanceof Double) {
             return (Double) propValue;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.