commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r633273 - in /commons/proper/configuration/branches/configuration2_experimental/src: main/java/org/apache/commons/configuration2/CombinedConfiguration.java test/java/org/apache/commons/configuration2/TestCombinedConfiguration.java
Date Mon, 03 Mar 2008 21:00:06 GMT
Author: oheger
Date: Mon Mar  3 13:00:03 2008
New Revision: 633273

URL: http://svn.apache.org/viewvc?rev=633273&view=rev
Log:
Some Java 1.5 improvements

Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestCombinedConfiguration.java

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java?rev=633273&r1=633272&r2=633273&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java
Mon Mar  3 13:00:03 2008
@@ -454,7 +454,7 @@
      * @return a set with the names of the contained configurations (never
      * <b>null</b>)
      */
-    public Set getConfigurationNames()
+    public Set<String> getConfigurationNames()
     {
         return namedConfigurations.keySet();
     }
@@ -535,9 +535,8 @@
     {
         CombinedConfiguration copy = (CombinedConfiguration) super.clone();
         copy.clear();
-        for (Iterator it = configurations.iterator(); it.hasNext();)
+        for (ConfigData cd : configurations)
         {
-            ConfigData cd = (ConfigData) it.next();
             copy.addConfiguration((AbstractConfiguration) ConfigurationUtils
                     .cloneConfiguration(cd.getConfiguration()), cd.getName(),
                     cd.getAt());
@@ -561,14 +560,13 @@
     {
         if (isForceReloadCheck())
         {
-            for (Iterator it = configurations.iterator(); it.hasNext();)
+            for (ConfigData cd : configurations)
             {
                 try
                 {
                     // simply retrieve a property; this is enough for
                     // triggering a reload
-                    ((ConfigData) it.next()).getConfiguration().getProperty(
-                            PROP_RELOAD_CHECK);
+                    cd.getConfiguration().getProperty(PROP_RELOAD_CHECK);
                 }
                 catch (Exception ex)
                 {
@@ -645,9 +643,8 @@
 
         else
         {
-            Iterator it = configurations.iterator();
-            ConfigurationNode node = ((ConfigData) it.next())
-                    .getTransformedRoot();
+            Iterator<ConfigData> it = configurations.iterator();
+            ConfigurationNode node = it.next().getTransformedRoot();
             while (it.hasNext())
             {
                 node = getNodeCombiner().combine(node,
@@ -676,9 +673,8 @@
         }
 
         // Check with the root nodes of the child configurations
-        for (Iterator it = configurations.iterator(); it.hasNext();)
+        for (ConfigData cd : configurations)
         {
-            ConfigData cd = (ConfigData) it.next();
             if (root == cd.getRootNode())
             {
                 return cd.getConfiguration();

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestCombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestCombinedConfiguration.java?rev=633273&r1=633272&r2=633273&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestCombinedConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestCombinedConfiguration.java
Mon Mar  3 13:00:03 2008
@@ -117,7 +117,7 @@
         assertSame("Added config not found", c, config.getConfiguration(0));
         assertSame("Added config not found by name", c, config
                 .getConfiguration(TEST_NAME));
-        Set names = config.getConfigurationNames();
+        Set<String> names = config.getConfigurationNames();
         assertEquals("Wrong number of config names", 1, names.size());
         assertTrue("Name not found", names.contains(TEST_NAME));
         assertTrue("Wrong property value", config.getBoolean(TEST_KEY));
@@ -174,7 +174,7 @@
      */
     private void checkAddConfig(AbstractConfiguration c)
     {
-        Collection listeners = c.getConfigurationListeners();
+        Collection<?> listeners = c.getConfigurationListeners();
         assertEquals("Wrong number of configuration listeners", 1, listeners
                 .size());
         assertTrue("Combined config is no listener", listeners.contains(config));



Mime
View raw message