You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@fluo.apache.org by gi...@git.apache.org on 2017/08/07 15:32:30 UTC

[GitHub] cjmctague commented on a change in pull request #902: fixes #894 merge SimpleConfiguration Objects

cjmctague commented on a change in pull request #902: fixes #894 merge SimpleConfiguration Objects
URL: https://github.com/apache/fluo/pull/902#discussion_r131686163
 
 

 ##########
 File path: modules/api/src/main/java/org/apache/fluo/api/config/SimpleConfiguration.java
 ##########
 @@ -250,6 +277,22 @@ public SimpleConfiguration subset(String prefix) {
     return new SimpleConfiguration(internalConfig.subset(prefix));
   }
 
+  /**
+   * @param SimpleConfigs SimpleConfiguration's to be merged
+   * @return SimpleConfiguration
+   * 
+   * @since 1.2.0
+   */
+  public static SimpleConfiguration merge(SimpleConfiguration... simpleConfigs) {
+    SimpleConfiguration mrg = new SimpleConfiguration();
+    for (SimpleConfiguration sc : simpleConfigs) {
+      for (Map.Entry<String, String> entry : sc.toMap().entrySet()) {
+        mrg.addProperty(entry.getKey(), entry.getValue());
 
 Review comment:
   I looked at that and to my understanding, setProperty over wrote the current properties. So when you loop through all the properties being merged, the second will clear and write over the first and so forth down the list. 
   `Set a property, this will replace any previously set values.`
   
   That's why I used add properties because it was more of a merge by adding all the properties together. I could be misunderstanding it.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services