brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #173: BROOKLYN-286: merge config keys map value...
Date Thu, 02 Jun 2016 10:04:41 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/173#discussion_r65514081
  
    --- Diff: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
---
    @@ -3308,4 +3314,20 @@ public PersistenceObjectStore newPersistenceObjectStore(String
container) {
             return new JcloudsBlobStoreBasedObjectStore(this, container);
         }
     
    +    // TODO Duplicate of EntityConfigMap.deepMerge
    +    private <T> Maybe<?> deepMerge(Maybe<? extends T> val1, Maybe<?
extends T> val2, ConfigKey<?> keyForLogging) {
    +        if (val2.isAbsent() || val2.isNull()) {
    +            return val1;
    +        } else if (val1.isAbsent()) {
    +            return val2;
    +        } else if (val1.isNull()) {
    +            return val1; // an explicit null means an override; don't merge
    +        } else if (val1.get() instanceof Map && val2.get() instanceof Map) {
    +            return Maybe.of(CollectionMerger.builder().build().merge((Map<?,?>)val1.get(),
(Map<?,?>)val2.get()));
    --- End diff --
    
    I'd expect a shallow merge here. That is being able to override the values of maps in
`templateOptions`. But the arguments could go either way. Doesn't really matter in the and
as all maps in `templateOptions` are of simple types.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message