commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1479368 - in /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration: ./ plist/
Date Sun, 05 May 2013 20:13:12 GMT
Author: oheger
Date: Sun May  5 20:13:12 2013
New Revision: 1479368

URL: http://svn.apache.org/r1479368
Log:
Made addProperty() final.

There is now a new addPropertyInternal() method which can be overridden by
subclasses.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java?rev=1479368&r1=1479367&r2=1479368&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
Sun May  5 20:13:12 2013
@@ -601,15 +601,13 @@ public abstract class AbstractConfigurat
         this.synchronizer = synchronizer;
     }
 
-    public void addProperty(String key, Object value)
+    public final void addProperty(String key, Object value)
     {
         getSynchronizer().beginWrite();
         try
         {
             fireEvent(EVENT_ADD_PROPERTY, key, value, true);
-            addPropertyValues(key, value,
-                    isDelimiterParsingDisabled() ? DISABLED_DELIMITER
-                            : getListDelimiter());
+            addPropertyInternal(key, value);
             fireEvent(EVENT_ADD_PROPERTY, key, value, false);
         }
         finally
@@ -619,6 +617,23 @@ public abstract class AbstractConfigurat
     }
 
     /**
+     * Actually adds a property to this configuration. This method is called by
+     * {@code addProperty()}. It performs list splitting if necessary and
+     * delegates to {@link #addPropertyDirect(String, Object)} for every single
+     * property value.
+     *
+     * @param key the key of the property to be added
+     * @param value the new property value
+     * @since 2.0
+     */
+    protected void addPropertyInternal(String key, Object value)
+    {
+        addPropertyValues(key, value,
+                isDelimiterParsingDisabled() ? DISABLED_DELIMITER
+                        : getListDelimiter());
+    }
+
+    /**
      * Adds a key/value pair to the Configuration. Override this method to
      * provide write access to underlying Configuration store.
      *

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java?rev=1479368&r1=1479367&r2=1479368&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java
Sun May  5 20:13:12 2013
@@ -129,15 +129,21 @@ public class DataConfiguration extends A
     }
 
     @Override
-    protected void addPropertyDirect(String key, Object obj)
+    protected void addPropertyInternal(String key, Object obj)
+    {
+        configuration.addProperty(key, obj);
+    }
+
+    @Override
+    protected void addPropertyDirect(String key, Object value)
     {
         if (configuration instanceof AbstractConfiguration)
         {
-            ((AbstractConfiguration) configuration).addPropertyDirect(key, obj);
+            ((AbstractConfiguration) configuration).addPropertyDirect(key, value);
         }
         else
         {
-            configuration.addProperty(key, obj);
+            configuration.addProperty(key, value);
         }
     }
 

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java?rev=1479368&r1=1479367&r2=1479368&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java
Sun May  5 20:13:12 2013
@@ -412,7 +412,7 @@ public class DatabaseConfiguration exten
      * @param value the value to be added
      */
     @Override
-    public void addProperty(String key, Object value)
+    protected void addPropertyInternal(String key, Object value)
     {
         boolean parsingFlag = isDelimiterParsingDisabled();
         try
@@ -422,7 +422,7 @@ public class DatabaseConfiguration exten
                 // temporarily disable delimiter parsing
                 setDelimiterParsingDisabled(true);
             }
-            super.addProperty(key, value);
+            super.addPropertyInternal(key, value);
         }
         finally
         {

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java?rev=1479368&r1=1479367&r2=1479368&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java
Sun May  5 20:13:12 2013
@@ -330,7 +330,7 @@ public class DynamicCombinedConfiguratio
     }
 
     @Override
-    public void addProperty(String key, Object value)
+    protected void addPropertyInternal(String key, Object value)
     {
         this.getCurrentConfig().addProperty(key, value);
     }

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java?rev=1479368&r1=1479367&r2=1479368&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
Sun May  5 20:13:12 2013
@@ -83,7 +83,7 @@ public class PatternSubtreeConfiguration
     }
 
     @Override
-    public void addProperty(String key, Object value)
+    protected void addPropertyInternal(String key, Object value)
     {
         config.addProperty(makePath(key), value);
     }

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java?rev=1479368&r1=1479367&r2=1479368&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
Sun May  5 20:13:12 2013
@@ -177,17 +177,15 @@ public class PropertyListConfiguration e
     }
 
     @Override
-    public void addProperty(String key, Object value)
+    protected void addPropertyInternal(String key, Object value)
     {
         if (value instanceof byte[])
         {
-            fireEvent(EVENT_ADD_PROPERTY, key, value, true);
             addPropertyDirect(key, value);
-            fireEvent(EVENT_ADD_PROPERTY, key, value, false);
         }
         else
         {
-            super.addProperty(key, value);
+            super.addPropertyInternal(key, value);
         }
     }
 

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.java?rev=1479368&r1=1479367&r2=1479368&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.java
Sun May  5 20:13:12 2013
@@ -185,17 +185,15 @@ public class XMLPropertyListConfiguratio
     }
 
     @Override
-    public void addProperty(String key, Object value)
+    protected void addPropertyInternal(String key, Object value)
     {
         if (value instanceof byte[])
         {
-            fireEvent(EVENT_ADD_PROPERTY, key, value, true);
             addPropertyDirect(key, value);
-            fireEvent(EVENT_ADD_PROPERTY, key, value, false);
         }
         else
         {
-            super.addProperty(key, value);
+            super.addPropertyInternal(key, value);
         }
     }
 



Mime
View raw message