commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r627984 [2/2] - in /commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2: ./ beanutils/ plist/ tree/ tree/xpath/ web/
Date Fri, 15 Feb 2008 09:46:14 GMT
Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorAttribute.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorAttribute.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorAttribute.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorAttribute.java
Fri Feb 15 01:46:09 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree.xpath;
 
 import java.util.ArrayList;
@@ -44,8 +45,7 @@
     public ConfigurationNodeIteratorAttribute(NodePointer parent, QName name)
     {
         super(parent, false);
-        initSubNodeList(createSubNodeList((ConfigurationNode) parent.getNode(),
-                name));
+        initSubNodeList(createSubNodeList((ConfigurationNode) parent.getNode(), name));
     }
 
     /**
@@ -55,15 +55,15 @@
      * @param name the name of the selected attribute
      * @return a list with the selected attributes
      */
-    protected List createSubNodeList(ConfigurationNode node, QName name)
+    protected List<ConfigurationNode> createSubNodeList(ConfigurationNode node, QName
name)
     {
         if (name.getPrefix() != null)
         {
             // namespace prefixes are not supported
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
 
-        List result = new ArrayList();
+        List<ConfigurationNode> result = new ArrayList<ConfigurationNode>();
         if (!WILDCARD.equals(name.getName()))
         {
             result.addAll(node.getAttributes(name.getName()));

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorBase.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorBase.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorBase.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorBase.java
Fri Feb 15 01:46:09 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree.xpath;
 
 import java.util.List;
@@ -42,7 +43,7 @@
     private NodePointer parent;
 
     /** Stores the list with the sub nodes. */
-    private List subNodes;
+    private List<ConfigurationNode> subNodes;
 
     /** Stores the current position. */
     private int position;
@@ -100,8 +101,7 @@
             return null;
         }
 
-        return createNodePointer((ConfigurationNode) subNodes
-                .get(positionToIndex(getPosition())));
+        return createNodePointer(subNodes.get(positionToIndex(getPosition())));
     }
 
     /**
@@ -149,7 +149,7 @@
      *
      * @param nodes the list with the sub nodes
      */
-    protected void initSubNodeList(List nodes)
+    protected void initSubNodeList(List<ConfigurationNode> nodes)
     {
         subNodes = nodes;
         if (reverse)
@@ -165,8 +165,7 @@
      */
     protected int getMaxPosition()
     {
-        return reverse ? getStartOffset() + 1 : subNodes.size()
-                - getStartOffset();
+        return reverse ? getStartOffset() + 1 : subNodes.size() - getStartOffset();
     }
 
     /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java
Fri Feb 15 01:46:09 2008
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree.xpath;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.commons.configuration2.tree.ConfigurationNode;
@@ -49,17 +49,15 @@
      * @param reverse the reverse flag
      * @param startsWith the first element of the iteration
      */
-    public ConfigurationNodeIteratorChildren(NodePointer parent,
-            NodeTest nodeTest, boolean reverse, NodePointer startsWith)
+    public ConfigurationNodeIteratorChildren(NodePointer parent, NodeTest nodeTest, boolean
reverse, NodePointer startsWith)
     {
         super(parent, reverse);
         ConfigurationNode root = (ConfigurationNode) parent.getNode();
-        List childNodes = createSubNodeList(root, nodeTest);
+        List<ConfigurationNode> childNodes = createSubNodeList(root, nodeTest);
         initSubNodeList(childNodes);
         if (startsWith != null)
         {
-            setStartOffset(findStartIndex(root,
-                    (ConfigurationNode) startsWith.getNode()));
+            setStartOffset(findStartIndex(root, (ConfigurationNode) startsWith.getNode()));
         }
     }
 
@@ -72,9 +70,9 @@
      * @param test the test object
      * @return a list with the matching nodes
      */
-    protected List createSubNodeList(ConfigurationNode node, NodeTest test)
+    protected List<ConfigurationNode> createSubNodeList(ConfigurationNode node, NodeTest
test)
     {
-        List children = node.getChildren();
+        List<ConfigurationNode> children = node.getChildren();
 
         if (test == null)
         {
@@ -93,10 +91,9 @@
                         return children;
                     }
 
-                    List result = new ArrayList();
-                    for (Iterator it = children.iterator(); it.hasNext();)
+                    List<ConfigurationNode> result = new ArrayList<ConfigurationNode>();
+                    for (ConfigurationNode child : children)
                     {
-                        ConfigurationNode child = (ConfigurationNode) it.next();
                         if (StringUtils.equals(name.getName(), child.getName()))
                         {
                             result.add(child);
@@ -117,7 +114,7 @@
             }
         }
 
-        return Collections.EMPTY_LIST;
+        return Collections.emptyList();
     }
 
     /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java
Fri Feb 15 01:46:09 2008
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree.xpath;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 
@@ -175,8 +175,7 @@
      * @param pointer2 another pointer
      * @return a flag, which pointer should be sorted first
      */
-    public int compareChildNodePointers(NodePointer pointer1,
-            NodePointer pointer2)
+    public int compareChildNodePointers(NodePointer pointer1, NodePointer pointer2)
     {
         ConfigurationNode node1 = (ConfigurationNode) pointer1.getBaseValue();
         ConfigurationNode node2 = (ConfigurationNode) pointer2.getBaseValue();
@@ -194,11 +193,9 @@
         else
         {
             // sort based on the occurrence in the sub node list
-            List subNodes = node1.isAttribute() ? node.getAttributes() : node
-                    .getChildren();
-            for (Iterator it = subNodes.iterator(); it.hasNext();)
+            List<ConfigurationNode> subNodes = node1.isAttribute() ? node.getAttributes()
: node.getChildren();
+            for (ConfigurationNode child : subNodes)
             {
-                ConfigurationNode child = (ConfigurationNode) it.next();
                 if (child == node1)
                 {
                     return -1;
@@ -231,11 +228,9 @@
      * @param reverse the reverse flag
      * @param startWith the start value of the iteration
      */
-    public NodeIterator childIterator(NodeTest test, boolean reverse,
-            NodePointer startWith)
+    public NodeIterator childIterator(NodeTest test, boolean reverse, NodePointer startWith)
     {
-        return new ConfigurationNodeIteratorChildren(this, test, reverse,
-                startWith);
+        return new ConfigurationNodeIteratorChildren(this, test, reverse, startWith);
     }
 
     /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointerFactory.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointerFactory.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointerFactory.java
Fri Feb 15 01:46:09 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree.xpath;
 
 import java.util.Locale;
@@ -59,8 +60,7 @@
     {
         if (bean instanceof ConfigurationNode)
         {
-            return new ConfigurationNodePointer((ConfigurationNode) bean,
-                    locale);
+            return new ConfigurationNodePointer((ConfigurationNode) bean, locale);
         }
         return null;
     }
@@ -74,13 +74,11 @@
      * @param bean the bean
      * @return a pointer for a configuration node if the bean is such a node
      */
-    public NodePointer createNodePointer(NodePointer parent, QName name,
-            Object bean)
+    public NodePointer createNodePointer(NodePointer parent, QName name, Object bean)
     {
         if (bean instanceof ConfigurationNode)
         {
-            return new ConfigurationNodePointer(parent,
-                    (ConfigurationNode) bean);
+            return new ConfigurationNodePointer(parent, (ConfigurationNode) bean);
         }
         return null;
     }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
Fri Feb 15 01:46:09 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree.xpath;
 
 import java.util.ArrayList;
@@ -110,8 +111,7 @@
     static final String ATTR_DELIMITER = "@";
 
     /** Constant for the delimiters for splitting node paths. */
-    private static final String NODE_PATH_DELIMITERS = PATH_DELIMITER
-            + ATTR_DELIMITER;
+    private static final String NODE_PATH_DELIMITERS = PATH_DELIMITER + ATTR_DELIMITER;
 
     /**
      * Executes a query. The passed in property key is directly passed to a
@@ -121,19 +121,26 @@
      * @param key the query to be executed
      * @return a list with the nodes that are selected by the query
      */
-    public List query(ConfigurationNode root, String key)
+    public List<ConfigurationNode> query(ConfigurationNode root, String key)
     {
         if (StringUtils.isEmpty(key))
         {
-            List result = new ArrayList(1);
+            List<ConfigurationNode> result = new ArrayList<ConfigurationNode>(1);
             result.add(root);
             return result;
         }
         else
         {
             JXPathContext context = createContext(root, key);
-            List result = context.selectNodes(key);
-            return (result != null) ? result : Collections.EMPTY_LIST;
+            List<ConfigurationNode> result = context.selectNodes(key);
+            if (result != null)
+            {
+                return result;
+            }
+            else
+            {
+                return Collections.emptyList();
+            }
         }
     }
 
@@ -205,19 +212,17 @@
         }
         if (index < 0)
         {
-            throw new IllegalArgumentException(
-                    "prepareAdd: Passed in key must contain a whitespace!");
+            throw new IllegalArgumentException("prepareAdd: Passed in key must contain a
whitespace!");
         }
 
-        List nodes = query(root, key.substring(0, index).trim());
+        List<ConfigurationNode> nodes = query(root, key.substring(0, index).trim());
         if (nodes.size() != 1)
         {
-            throw new IllegalArgumentException(
-                    "prepareAdd: key must select exactly one target node!");
+            throw new IllegalArgumentException("prepareAdd: key must select exactly one target
node!");
         }
 
         NodeAddData data = new NodeAddData();
-        data.setParent((ConfigurationNode) nodes.get(0));
+        data.setParent(nodes.get(0));
         initNodeAddData(data, key.substring(index).trim());
         return data;
     }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/web/BaseWebConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/web/BaseWebConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/web/BaseWebConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/web/BaseWebConfiguration.java
Fri Feb 15 01:46:09 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.web;
 
 import java.util.List;
@@ -99,8 +100,7 @@
     {
         if (!isDelimiterParsingDisabled() && value instanceof String)
         {
-            List list = PropertyConverter.split((String) value,
-                    getListDelimiter());
+            List<String> list = PropertyConverter.split((String) value, getListDelimiter());
             value = list.size() > 1 ? list : list.get(0);
         }
 



Mime
View raw message