Repository: incubator-tamaya
Updated Branches:
  refs/heads/master ccabc905d -> 76524b2e4


Better name of the default policy for value combination.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/76524b2e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/76524b2e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/76524b2e

Branch: refs/heads/master
Commit: 76524b2e47d5a36621caa3fa2d6dc72f415e7e57
Parents: ccabc90
Author: Oliver B. Fischer <[email protected]>
Authored: Mon Oct 9 00:44:30 2017 +0200
Committer: Oliver B. Fischer <[email protected]>
Committed: Mon Oct 9 00:44:30 2017 +0200

----------------------------------------------------------------------
 .../tamaya/spi/PropertyValueCombinationPolicy.java      | 12 +++++++++---
 .../tamaya/spi/PropertyValueCombinationPolicyTest.java  |  4 ++--
 .../core/internal/DefaultConfigurationContext.java      |  2 +-
 .../internal/DefaultConfigurationContextBuilder.java    |  5 ++---
 .../core/internal/DefaultConfigurationContextTest.java  |  2 +-
 5 files changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/76524b2e/code/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
----------------------------------------------------------------------
diff --git 
a/code/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
 
b/code/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
index 81e4b60..14640e6 100644
--- 
a/code/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
+++ 
b/code/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
@@ -22,7 +22,7 @@ package org.apache.tamaya.spi;
 /**
  * Policy that determines how the final value of a configuration entry is 
evaluated. An instances of this
  * interface can be registered to get control how multiple PropertySources are 
combined. This is useful in cases
- * where the default overriding policy as implemented in {@link 
#DEFAULT_OVERRIDING_COLLECTOR} is not matching
+ * where the default overriding policy as implemented in {@link 
#DEFAULT_OVERRIDING_POLICY} is not matching
  * the need of the current application, e.g. then entries containing multiple 
values should be combined to new
  * values instead of overridden.
  */
@@ -32,17 +32,23 @@ public interface PropertyValueCombinationPolicy {
      * Default overriding collector, where each existing entry ({@code 
current} is overridden by a subsequent non-null
      * entry evaluated by {@code propertySource.get(key)}.
      */
-    PropertyValueCombinationPolicy DEFAULT_OVERRIDING_COLLECTOR = new 
PropertyValueCombinationPolicy(){
+    PropertyValueCombinationPolicy DEFAULT_OVERRIDING_POLICY = new 
PropertyValueCombinationPolicy(){
 
         @Override
         public PropertyValue collect(PropertyValue currentValue, String key, 
PropertySource propertySource) {
             PropertyValue value = propertySource.get(key);
             return value!=null?value:currentValue;
         }
-
     };
 
     /**
+     * @deprecated Use {@linkplain #DEFAULT_OVERRIDING_POLICY} instead. Will 
be removed in 1.0.
+     */
+    @Deprecated
+    PropertyValueCombinationPolicy DEFAULT_OVERRIDING_COLLECTOR = 
DEFAULT_OVERRIDING_POLICY;
+
+
+        /**
      * Method that is called for each value evaluated by a PropertySource for 
the given key. This method is called
      * either when a single key is accessed, e.g. by calling {@code 
org.apache.tamaya.Configuration.getXXX}, but also
      * when the full configuration property map is accessed by calling

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/76524b2e/code/api/src/test/java/org/apache/tamaya/spi/PropertyValueCombinationPolicyTest.java
----------------------------------------------------------------------
diff --git 
a/code/api/src/test/java/org/apache/tamaya/spi/PropertyValueCombinationPolicyTest.java
 
b/code/api/src/test/java/org/apache/tamaya/spi/PropertyValueCombinationPolicyTest.java
index c725e1b..c7a4698 100644
--- 
a/code/api/src/test/java/org/apache/tamaya/spi/PropertyValueCombinationPolicyTest.java
+++ 
b/code/api/src/test/java/org/apache/tamaya/spi/PropertyValueCombinationPolicyTest.java
@@ -29,7 +29,7 @@ public class PropertyValueCombinationPolicyTest {
 
     @Test
     public void 
defaulPolicyOverridesCurrentValueByTheOneOfTheGivenProperySource() throws 
Exception {
-        PropertyValueCombinationPolicy policy = 
PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+        PropertyValueCombinationPolicy policy = 
PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
 
         PropertyValue current = PropertyValue.of("a", "AAA", "Test");
         PropertyValue result = policy.collect(current, "a", new 
DummyPropertySource());
@@ -40,7 +40,7 @@ public class PropertyValueCombinationPolicyTest {
 
     @Test
     public void 
defaulPolicyOverridesKeepsTheCurrentValueIfGivenProperySourceDoesNotHaveIt() 
throws Exception {
-        PropertyValueCombinationPolicy policy = 
PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+        PropertyValueCombinationPolicy policy = 
PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
 
         PropertyValue current = PropertyValue.of("a", "AAA", "Test");
         PropertyValue result = policy.collect(current, "a", 
PropertySource.EMPTY);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/76524b2e/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
----------------------------------------------------------------------
diff --git 
a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
 
b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
index a1b19d1..f3126af 100644
--- 
a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
+++ 
b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
@@ -98,7 +98,7 @@ public class DefaultConfigurationContext implements 
ConfigurationContext {
             propertyValueCombinationPolicy = 
ServiceContextManager.getServiceContext().getService(PropertyValueCombinationPolicy.class);
         }
         if(propertyValueCombinationPolicy==null){
-            propertyValueCombinationPolicy = 
PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+            propertyValueCombinationPolicy = 
PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/76524b2e/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git 
a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
 
b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
index 35590f9..8d4dda4 100644
--- 
a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
+++ 
b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
@@ -55,8 +55,7 @@ public class DefaultConfigurationContextBuilder implements 
ConfigurationContextB
 
     List<PropertyFilter> propertyFilters = new ArrayList<>();
     List<PropertySource> propertySources = new ArrayList<>();
-    PropertyValueCombinationPolicy combinationPolicy =
-            PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+    PropertyValueCombinationPolicy combinationPolicy = 
PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
     Map<TypeLiteral<?>, Collection<PropertyConverter<?>>> propertyConverters = 
new HashMap<>();
 
     /**
@@ -385,7 +384,7 @@ public class DefaultConfigurationContextBuilder implements 
ConfigurationContextB
 
     protected ConfigurationContextBuilder loadDefaults() {
         checkBuilderState();
-        this.combinationPolicy = 
PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+        this.combinationPolicy = 
PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
         addDefaultPropertySources();
         addDefaultPropertyFilters();
         addDefaultPropertyConverters();

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/76524b2e/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextTest.java
----------------------------------------------------------------------
diff --git 
a/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextTest.java
 
b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextTest.java
index fef8ed3..7c483bb 100644
--- 
a/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextTest.java
+++ 
b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextTest.java
@@ -160,7 +160,7 @@ public class DefaultConfigurationContextTest {
         ConfigurationContext ctx = new 
DefaultConfigurationContextBuilder().build();
         assertNotNull(ctx.getPropertyValueCombinationPolicy());
         assertEquals(ctx.getPropertyValueCombinationPolicy(),
-                PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR);
+                PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY);
     }
 
     @Test

Reply via email to