commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r659181 - /commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/Builtin.java
Date Thu, 22 May 2008 18:02:51 GMT
Author: rahul
Date: Thu May 22 11:02:50 2008
New Revision: 659181

URL: http://svn.apache.org/viewvc?rev=659181&view=rev
Log:
Remove two deprecated methods.

Modified:
    commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/Builtin.java

Modified: commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/Builtin.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/Builtin.java?rev=659181&r1=659180&r2=659181&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/Builtin.java (original)
+++ commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/Builtin.java Thu
May 22 11:02:50 2008
@@ -169,88 +169,6 @@
     }
 
     /**
-     * Implements the Data() function for Commons SCXML documents, that
-     * can be used to obtain a node from one of the XML data trees.
-     * Manifests within "location" attribute of <assign> element,
-     * for Commons JEXL and Commons EL based documents.
-     *
-     * @param data The context Node, though the method accepts an Object
-     *             so error is reported by Commons SCXML, rather
-     *             than the underlying expression language.
-     * @param path The XPath expression.
-     * @return The first node matching the path, or null if no nodes match.
-     *
-     * @deprecated Use {@link #dataNode(Map,Object,String)} instead
-     */
-    public static Node dataNode(final Object data, final String path) {
-        if (data == null || !(data instanceof Node)) {
-            Log log = LogFactory.getLog(Builtin.class);
-            log.error("Data(): Cannot evaluate an XPath expression"
-                + " in the absence of a context Node, null returned");
-            return null;
-        }
-        Node dataNode = (Node) data;
-        NodeList result = null;
-        try {
-            result = XPathAPI.selectNodeList(dataNode, path);
-        } catch (TransformerException te) {
-            Log log = LogFactory.getLog(Builtin.class);
-            log.error(te.getMessage(), te);
-            return null;
-        }
-        int length = result.getLength();
-        if (length == 0) {
-            Log log = LogFactory.getLog(Builtin.class);
-            log.warn("Data(): No nodes matching the XPath expression \""
-                + path + "\", returning null");
-            return null;
-        } else {
-            if (length > 1) {
-                Log log = LogFactory.getLog(Builtin.class);
-                log.warn("Data(): Multiple nodes matching XPath expression"
-                    + path + "\", returning first");
-            }
-            return result.item(0);
-        }
-    }
-
-    /**
-     * A variant of the Data() function for Commons SCXML documents,
-     * coerced to a Double, a Long or a String, whichever succeeds,
-     * in that order.
-     * Manifests within rvalue expressions in the document,
-     * for Commons JEXL and Commons EL based documents..
-     *
-     * @param data The context Node, though the method accepts an Object
-     *             so error is reported by Commons SCXML, rather
-     *             than the underlying expression language.
-     * @param path The XPath expression.
-     * @return The first node matching the path, coerced to a String, or null
-     *         if no nodes match.
-     *
-     * @deprecated Use {@link #data(Map,Object,String)} instead
-     */
-    public static Object data(final Object data, final String path) {
-        Object retVal = null;
-        String strVal = SCXMLHelper.getNodeValue(dataNode(data, path));
-        // try as a double
-        try {
-            double d = Double.parseDouble(strVal);
-            retVal = new Double(d);
-        } catch (NumberFormatException notADouble) {
-            // else as a long
-            try {
-                long l = Long.parseLong(strVal);
-                retVal = new Long(l);
-            } catch (NumberFormatException notALong) {
-                // fallback to string
-                retVal = strVal;
-            }
-        }
-        return retVal;
-    }
-
-    /**
      * Prefix resolver for XPaths pointing to <data> nodes.
      */
     private static class DataPrefixResolver implements PrefixResolver {



Mime
View raw message