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 08:25:43 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/340#discussion_r79994306
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java ---
    @@ -1209,59 +1208,18 @@ public void remove(AttributeSensor<?> attribute) {
         public class BasicConfigurationSupport extends AbstractConfigurationSupportInternal
{
     
             @Override
    -        public <T> T get(ConfigKey<T> key) {
    -            return configsInternal.getConfig(key);
    -        }
    -
    -        @Override
    -        public <T> T set(ConfigKey<T> key, T val) {
    +        protected <T> void assertValid(ConfigKey<T> key, T val) {
                 ConfigConstraints.assertValid(AbstractEntity.this, key, val);
    -            return setConfigInternal(key, val);
    -        }
    -
    -        @Override
    -        public <T> T set(ConfigKey<T> key, Task<T> val) {
    -            return setConfigInternal(key, val);
    -        }
    -
    -        @Override
    -        public ConfigBag getBag() {
    -            return configsInternal.getAllConfigBag();
    -        }
    -
    -        @Override
    -        public ConfigBag getLocalBag() {
    -            return configsInternal.getLocalConfigBag();
    -        }
    -
    -        @Override
    -        public Maybe<Object> getRaw(ConfigKey<?> key) {
    -            return configsInternal.getConfigRaw(key, true);
             }
    -
    -        @Override
    -        public Maybe<Object> getLocalRaw(ConfigKey<?> key) {
    -            return configsInternal.getConfigRaw(key, false);
    -        }
    -
    -        @Override
    -        public void addToLocalBag(Map<String, ?> vals) {
    -            configsInternal.addToLocalBag(vals);
    -        }
    -
    -        @Override
    -        public void removeFromLocalBag(String key) {
    -            configsInternal.removeFromLocalBag(key);
    +        
    +        protected AbstractConfigMapImpl<?> getConfigsInternal() {
    --- End diff --
    
    For example, the pattern we've used elsewhere is to have an interface with suffix "Internal"
for the internal methods, so the implementation class is hidden away as much as possible.
We could add a `ConfigMapInternal` for the methods that really have to be visible to the rest
of the Brooklyn framework.


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