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

 ##########
 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 might be missing something (maybe @keith-turner can weigh in too) but I 
think the goal of this ticket is to merge the files so each the final 
configuration contains a union of all properties. If properties are in multiple 
files, only one value should be chosen (so setProperty should be used to 
merge).  The merge method just needs to document which file will take 
precedent.  If addProperty() is used, a list of values will be returned to the 
user when they retrieve a property that was in multiple files.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to