commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1437733 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java
Date Wed, 23 Jan 2013 21:03:11 GMT
Author: oheger
Date: Wed Jan 23 21:03:10 2013
New Revision: 1437733

URL: http://svn.apache.org/viewvc?rev=1437733&view=rev
Log:
Used new features provided by ConfigurationInterpolator to setup a default interpolator in
AbstractConfiguration.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.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=1437733&r1=1437732&r2=1437733&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
Wed Jan 23 21:03:10 2013
@@ -24,7 +24,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -36,7 +35,7 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.event.ConfigurationErrorEvent;
 import org.apache.commons.configuration.event.ConfigurationErrorListener;
 import org.apache.commons.configuration.interpol.ConfigurationInterpolator;
-import org.apache.commons.configuration.interpol.DefaultLookups;
+import org.apache.commons.configuration.interpol.InterpolatorSpecification;
 import org.apache.commons.configuration.interpol.Lookup;
 import org.apache.commons.lang.BooleanUtils;
 import org.apache.commons.lang.ClassUtils;
@@ -323,11 +322,13 @@ public abstract class AbstractConfigurat
             Map<String, ? extends Lookup> prefixLookups,
             Collection<? extends Lookup> defLookups)
     {
-        ConfigurationInterpolator ci = new ConfigurationInterpolator();
-        ci.registerLookups(prefixLookups);
-        ci.addDefaultLookups(defLookups);
-        ci.addDefaultLookup(new ConfigurationLookup(this));
-        setInterpolator(ci);
+        InterpolatorSpecification spec =
+                new InterpolatorSpecification.Builder()
+                        .withPrefixLookups(prefixLookups)
+                        .withDefaultLookups(defLookups)
+                        .withDefaultLookup(new ConfigurationLookup(this))
+                        .create();
+        setInterpolator(ConfigurationInterpolator.fromSpecification(spec));
     }
 
     /**
@@ -432,12 +433,8 @@ public abstract class AbstractConfigurat
      */
     private void installDefaultInterpolator()
     {
-        Map<String, Lookup> lookups = new HashMap<String, Lookup>();
-        for (DefaultLookups l : DefaultLookups.values())
-        {
-            lookups.put(l.getPrefix(), l.getLookup());
-        }
-        installInterpolator(lookups, null);
+        installInterpolator(
+                ConfigurationInterpolator.getDefaultPrefixLookups(), null);
     }
 
     /**



Mime
View raw message