brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #340: ConfigMap refactor, respecting inheritanc...
Date Thu, 22 Sep 2016 07:23:19 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/340#discussion_r79986472
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/internal/BrooklynPropertiesImpl.java
---
    @@ -439,24 +442,45 @@ public void putAll(Map vals) {
         }
     
         @Override
    -    public Object getRawConfig(ConfigKey<?> key) {
    -        return get(key.getName());
    +    public Maybe<Object> getConfigRaw(ConfigKey<?> key) {
    +        if (containsKey(key.getName())) return Maybe.of(get(key.getName()));
    +        return Maybe.absent();
         }
         
         @Override
         public Maybe<Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited)
{
    -        if (containsKey(key.getName())) return Maybe.of(get(key.getName()));
    -        return Maybe.absent();
    +        return getConfigRaw(key);
         }
     
         @Override
    -    public Map<ConfigKey<?>, Object> getAllConfig() {
    +    public Maybe<Object> getConfigLocalRaw(ConfigKey<?> key) {
    +        return getConfigRaw(key);
    +    }
    +    
    +    @Override
    +    public Map<ConfigKey<?>,Object> getAllConfigLocalRaw() {
             Map<ConfigKey<?>, Object> result = new LinkedHashMap<ConfigKey<?>,
Object>();
             for (Object entry: entrySet())
                 result.put(new BasicConfigKey<Object>(Object.class, ""+((Map.Entry)entry).getKey()),
((Map.Entry)entry).getValue());
             return result;
         }
     
    +    @Override @Deprecated
    +    public Map<ConfigKey<?>, Object> getAllConfig() {
    +        return getAllConfigLocalRaw();
    +    }
    +
    +    @Override
    +    public Set<ConfigKey<?>> findKeys(Predicate<ConfigKey<?>>
filter) {
    +        Set<ConfigKey<?>> result = new LinkedHashSet<ConfigKey<?>>();
    +        for (Object entry: entrySet()) {
    --- End diff --
    
    Yuck that we have to use generics like this! Would we nice to change `BrooklynProperties`
interface to not just extend `Map`, but definitely not in this huge PR!


---
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